If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Append to file

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-02-04, 18:42
pranav610 pranav610 is offline
Registered User
 
Join Date: Jan 2004
Posts: 25
Append to file

Need to come up with a bash script that will add text to new line in a file.
eg: File "append"
line1
line2
line3

Need to come up with a script that will add line 4 and line 5 after line3 as follows to append file:
line1
line2
line3
line4
line5
Reply With Quote
  #2 (permalink)  
Old 06-02-04, 20:30
saccskiz saccskiz is offline
Registered User
 
Join Date: Feb 2004
Posts: 143
I hope I have understood your question correctly -
If you have a file called append.txt containing

line1
line2
line3

If you need to add line4 and line5 below line3, all that is needed is to append
to this already existing append.txt file
Can be done by giving in the script -

echo "line4" >> append.txt
echo "line5" >> append.txt

Let me know if what I understood was not your question
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On