![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Removing asterix (*) from flat files | ctrl_alt_del | Shell Programming and Scripting | 3 | 10-18-2007 09:29 AM |
| Copy all the files with time stamp and remove header,trailer from file | ksrams | UNIX for Dummies Questions & Answers | 35 | 07-30-2007 02:15 PM |
| Help with a Flat File!!! | kumarsaravana_s | Shell Programming and Scripting | 11 | 06-07-2007 11:15 PM |
| Count No of Records in File without counting Header and Trailer Records | guiguy | Shell Programming and Scripting | 2 | 06-07-2007 12:15 PM |
| Remove header(first line) and trailer(last line) in ANY given file | madhunk | Shell Programming and Scripting | 2 | 03-13-2006 03:36 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Removing trailer from a flat file!!!
Hi,
I get some flat files with trailer which gives the totol records count and i want to remove the trailer from the file. i used the following command it works fine with a single file. cat file_name | grep -v 'Total records:' > file1 mv file file_name But i dont know how to remove the trailer when we have more than 1 file and how to redirect them and move them back to the original file name The syntax of file is : <date>.file_name.txt something like 06222007.aaa_ddd_ccc_ddd.txt 06212007.aaa_ddd_ccc_ddd.txt 06202007.aaa_ddd_ccc_ddd.txt Regards, Kumar |
|
||||
|
Quote:
|
|
||||
|
Quote:
When i run the following code,it gets into an infinite loop and never comes out. #!/usr/bin/ksh cd /space/tmp/file for filename in *aaa_ddd_ccc_ddd.txt do grep -v 'Total records:' > $filename_new mv $filename_new $filename done |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|