SUMMARY: Script file to add new line of text to a text file.

From: Steven Quan (stequa@auto-trol.ca)
Date: Tue Mar 21 2000 - 17:55:26 CST


Thanks so very much to all of you: John.Julian, Couprie, CF (Kees),
David Ledger, Rasana Atreya, Waghode Sanjay, Bertrand_Hutin, Griffiths,
Dan M., David Evans, David Massey, John Wynstra, Stephen P
Richardson, Michael DeSimone, Pat Eyler, Alan Orndorff, Vladimir,
David Foster, Russ Poffenberger, Stan Francis.
If I miss to mention someone above, please forgive me.

Some people suggests using Perl, Sed, or ED. I ended up using sed as
followed, using csh and sed

#!/bin/csh
# Replace 'program' with '#program'
sed 's/program/#program/' original_file > temp_file1
# Insert one line above / below the line which has the text '#program' on
it.
sed '/#program/i\\
program /bin/emacs' temp_file1 > temp_file2
mv -f original_file original_file.bak
/usr/bin/rm -f temp_file1
mv temp_file2 original_file

Again, thank you.
s.q.



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:14:05 CDT