![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 !! |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
sed help
Hi,
I have a file and i have to insert a line above a particular line in the file. In the file the lines starts with dates and can have lines starting with repeated dates. I want to search(first occurence) for a line starting with particular date and insert a line above that line Ex sample.txt ------------------------------- 013008 ....... 013008 ....... 013108 ....... 013108 ....... 013008 ....... 020108 020108 ........ Say i want to search for a line starting with 020108(first occurence ) and insert a line above it. Can you please give me the sed command for that or perl onliner. Thanks in advance ammuu Last edited by ammu; 02-01-2008 at 11:48 AM.. |
|
||||
|
Thanks for replying
When I execute the command it is throwing an error $sed '1,/020108/{//i\add this line} ' a.txt sed: command garbled: 1,/020108/{//i\add this line} I need to add a line which out creating any temp files Thanks Ammu |