Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: bondtrails
  • Content: Threads
  • Order by date
  1. bondtrails

    How to delete files older than X generations...

    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...
  2. bondtrails

    Replacing non-printable characters...

    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...
  3. bondtrails

    Splitting a file...

    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...
  4. bondtrails

    Oversize packet error...

    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...
  5. bondtrails

    Searching in fixed locations with AWK...

    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...
  6. bondtrails

    Write to multiple files in awk via another file...

    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...
  7. bondtrails

    How to drop n chars from a record...

    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...
  8. bondtrails

    using awk in a script...

    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...
  9. bondtrails

    Comparing and extracting from 2 files...

    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...
  10. bondtrails

    Grabbing output from grep and awk into a variable...

    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...
  11. bondtrails

    how to capture ftp output?

    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...
  12. bondtrails

    How to search by fixed location...

    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...
  13. bondtrails

    My simple grep script hangs!! :-(

    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'...

Part and Inventory Search

Back
Top