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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting a line on a file 104mb

Status
Not open for further replies.

maxcrook

Programmer
Jan 25, 2001
210
GB
Help urgently

I need to insert the test V6 into 26 files all of size 104mb. The text V6 needs to go onto the first line of each file.

I cannot use vi as there is not enough memory to enable me to do this. Can I do it using sed ?

The files are all call CallsFrm.arc.n

Urgent assistance required if possible !

Thanks

Max
 
Hi
Try:
for i in `ls CallsFrm.arc.*`
do
echo -n V6 > newfile
cat $i >> newfile
mv newfile $i
done

(backup your files 1st!)
 
Thanks that worked but I screwed up on one file i now need to get rid of the first line in a file using sed the pattern on the first line in the file is

V

 
use grep, as long as only the one line contains just 'V'

grep -v '^V$' oldfile > newfile Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Cheers again Mike that did the trick it can also be done using:

sed -e 's/^V$/V6/' oldfilename > newfilename

Thanks

Max
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top