Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 24-06-2009
Member
 
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.
Reply With Quote
  #2  
Old 24-06-2009
Member
 
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.
Reply With Quote
  #3  
Old 24-06-2009
Member
 
Join Date: Apr 2008
Posts: 2,001
Re: How to use sed to insert lines in a file

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

Quote:
x="this is the line"
sed '$ i '"$x"'' file
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


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


All times are GMT +5.5. The time now is 12:08 AM.