Results 1 to 2 of 2

Thread: Append to file

  1. #1
    Join Date
    Jan 2004
    Posts
    25

    Unanswered: 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

  2. #2
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •