Results 1 to 3 of 3

Thread: How to use sed to insert lines in a file

  1. #1
    Join Date
    Apr 2009
    Posts
    97

    How to use sed to insert lines in a file

    I am new to Sed and would like to know that how to use sed to insert lines in a file. Can any body tell me that how can i do so? Does any body knows about it? Kindly provide me the correct solution for the above issue. Any kind of help on the above issue would be appreciated.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: How to use sed to insert lines in a file

    For that you need to just add one at the end. For that you need to just type in sed '10s/$/\ntext to add/' or sed '10a text to add' Both these line will help you to insert a line in a text file.

  3. #3
    Join Date
    Apr 2008
    Posts
    2,005

    Re: How to use sed to insert lines in a file

    I don't know but you can try the following code:-

    x="this is the line"
    sed '$ i '"$x"'' file

Similar Threads

  1. Create .bat and insert lines from .vbs
    By Micka in forum Software Development
    Replies: 3
    Last Post: 08-05-2010, 07:48 PM
  2. How to insert random lines
    By MADGE25 in forum Software Development
    Replies: 4
    Last Post: 25-11-2009, 05:16 PM
  3. Batch Commands To Read and Delete Lines from txt-File
    By officer07 in forum Windows Server Help
    Replies: 3
    Last Post: 04-03-2009, 12:49 PM
  4. Batch Script to parse lines in text file
    By jntoner1@gmail.com in forum Windows Server Help
    Replies: 8
    Last Post: 28-01-2009, 04:38 AM
  5. Insert PDF File
    By Fanibhushan in forum MS Office Support
    Replies: 3
    Last Post: 06-03-2008, 04:39 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,594,434.53833 seconds with 16 queries