The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
help needed nnayagam Shell Programming and Scripting 2 03-07-2008 02:34 AM
Little help needed. Netghost AIX 5 08-10-2006 11:29 AM
Help needed dsravan Shell Programming and Scripting 2 07-20-2006 06:37 AM
awk help needed. cskumar Shell Programming and Scripting 0 07-20-2006 04:24 AM
Sed help needed stevefox Shell Programming and Scripting 5 12-04-2005 09:44 PM

Closed Thread
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-03-2003
danhodges99
Guest
 

Posts: n/a
Help needed with sed

Hi,

I need to insert a line into a file underneath an existing line in the file, but am unsure as to the syntax. I'm pretty sure sed can be used though, although any ideas are more than welcome. For example:

File
----
Line 1
Line 2
Line 3
Line 4
Line 6

I need to say: Insert "Line 5" after "Line 4".
Hope this is clear
Forum Sponsor
  #2 (permalink)  
Old 03-03-2003
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,318
Code:
# insert a line so that the new line will be line number 5
sed '5i\
A new line' < $file
Google UNIX.COM
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:35 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0