Hello..
I have a text file with 100 lines of data.
I need to add 1 line of data to that already existing file at the first line( beginning of the file) , so that the already existing 100 lines will start from 2 nd line.Now the file will have 101 lines of data.
Help me on how to add the line of data ??
--Charan..
Hi,
I am a newbee as well,
I think u can do it in followig ways,
1) open the file in VI and add the first line at the top
2) put the new line into another file say file2 and then
do
cat file2 exsistingfile > newfile
newfile is your output
grp please correct me if i m wrong
bye
Gaurav
echo "1i\nthis is the line that u wanted to insert \n.\nwq" | ex -s filename
with sed...
sed '1 i\
new first line' file > newfile && mv newfile file
with perl (edit file in place)...
perl -p -i -e '$_ = "new first line\n$_" if ( $. == 1 );' file
Cheers
ZB
Madhan,
When i use
echo "1i\nGROUP_NAME,JOB_NAME,STATUS,PROCESS_GROUP,JOB_START,JOB_END \n.\nwq" | ex -s abc.txt
where abc.txt contains only
Hello
Testing
Insert
I am getting this..
dumb: Unknown terminal type
ksh: 19464 Segmentation Fault
Is that a major error..If so, How to overcome ??