SUMMARY - looking for a script

From: Val (vpopa@sms.mc.xerox.com)
Date: Tue Jun 15 1999 - 12:27:46 CDT


Original question:
> Hi
>
> 1) I need to find a pattern within a file (say ABCDEFG) then from that pattern
> (including the line it has it) remove lines to the end of the file.
> 2. Append 6 new lines to the end of the same file.
>
> Although I know how to do it using vi, I have to do it for 10000 files .
>
> Can anybody help.
> Thanks,
> Val

I received several answers :

1) Use perl
2) Use sed combined with awk

I opted for #2

cat file | sed -e '/ABCDEFG/,$d' | cat - append_me > file1

Thanks to:
Tim Pointing <Tim.Pointing@dciem.dnd.ca>
Richard Bond <rbond@cellworks.mbt.washington.edu>
Amjad Zamil <amjadz@sts.com.jo>
Michael Kriss <kriss@fnal.gov>
James Ranks <ranks@avnasis.jccbi.gov>
Norbert Poellmann <np@bsn.com>
Luis Pablo Perez <pperez@cidi.com.ar>
emh <emh@starnetc.com>
Michael Kriss <kriss@fnal.gov>
Jon LaBadie <jon@jgcomp.com>
jim@nga.com (Jim Roy)



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:13:21 CDT