Hello all!
I am new to unix scripting and I am trying to learn a few things by writing in unix scripts utility programs I wrote in other languages. Here is where I am currently stumped:
I would like to delete files older than "X" generations. By that I mean if in a given directory there are 10...
Hi all,
This newbie needs some help. I've been playing with AWK and SED and am trying to figure out how to replace all non-printable characters with a "."
Actually, can someone tell me how in AWK or SED, I can replace any ASCII characters in the range of 0 - 31 (x0 - x1F), but not the line feed...
Hi all,
I am a bit stuck here with a seemingly simple process: How do I split a file of say X records into n files each file having X/n records?
So if I have a 30,000 record file, how can I split the file into 3 files with each file containing 10,000 records?
Thanks for helping out the newbie...
Hello everyone,
When i try to download a file from a server to my laptop via AFP (Apple File Protocol over TCP/IP), the file transfer is unbearably SLOW. Transferring a 1 meg file takes about 2 mins (that's way too slow). However, uploading the same file to the server takes about the time to...
Hi all,
how can I match using fixed locations. It seems like AWK allows pattern matching, but I need to match in a fixed position. Ex:
FileA.txt contains:
aaaaJobCode bbbbb
aaaaJobControlbbbbb
aaaaJobStatus ccccc
eeeeJob dddddd
If I want only those records that match "Job...
Hey everyone,
newbie #1 still learning awk. I need some help: I have a file, each record contains data and a filename. I want my awk program to append each record to a file whose file name is on that records. For example, if file FILE_A.txt contains:
filename_1.txt data data data
filename_1.txt...
Hi all,
what's the best way to drop n characters from each record in a given file? The n characters are consecutive, but they could be at the beginning, middle, or end of the record.
For example, given file A.txt which has a record length of 1000, how can I get make file B.txt which has a...
Hi everyone,
I can't seem to get shell quoting correct in a unix script.
I tried this command in the command line, and it works great:
awk -v file="input1.dat" -f program.awk input2.dat > output.dat
but i can't seem to make it work in a script--I've tried a few quoting combination...
Hi everyone, I need some help! (again):
I want to compare a set of fields on 2 files and create a third file where they differ. I'm not sure how to do it and I need some help!!
More info:
I wish to compare column locations 32-49 of files A and B. For those records in B that don't exist in A, I...
Hi everyone,
if the file inFile.txt containts:
0001 GOODBYE a001.txt
0002 HELLO b001.txt
0003 STAY c001.txt
and when I type this on the command line,
grep 'HELLO' inFile.txt | awk '{ print $3 }'
the output is a001.txt
but how can I do this in a script?
I have tried:
#!/bin/sh...
Hi everyone,
Within a script, how can I capture the output of an ftp "ls" command??
I want to capture the directory output of an ftp site, then create a simple list of all files ending in ".dat"
---------
ftp -n $HOST
quote USER $USER
quote PASS $PASS
cd $DIRECTORY
ls...
Hi everyone,
I am a relative newbie and have diligently been reading up on grep, sed and awk (and a few other unix goodies).
It seems that searching and extracting is done mainly by pattern matching. But what if I want to do a search on some fixed locations within a file.
For example: If i...
I try running this in super simple script in OS X, but it hangs..WHASSUP??
#!/bin/sh
# source and target directories
SOURCE_DIR='/Volumes/data_grp/HR/HROne/HROneDataWarehouse/Business Requirements/Data Management/Job Code Processing/NAM - Raw Source'...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.