The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Search, replace string in file1 with string from (lookup table) file2? gstuart Shell Programming and Scripting 2 04-11-2008 11:32 AM
Perl: Search for string on line then search and replace text Crypto Shell Programming and Scripting 4 01-04-2008 07:24 AM
Insert line break in vi's command mode Skogsmulle UNIX for Dummies Questions & Answers 3 07-06-2007 07:47 AM
String Search & Replace IwishIknewC UNIX for Dummies Questions & Answers 1 03-25-2006 03:28 AM
string search replace krishna UNIX for Advanced & Expert Users 1 12-19-2001 10:49 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 06-07-2006
Registered User
 

Join Date: Aug 2005
Posts: 229
how to insert line break + string in vi (search & replace )

Hello all
i have big test file that has allot of structure text something like this :
<foo1 *.html>
<blah action>
somthing 1
somthing 2
</blah>
</foo1 >

now i will like to insert 2 more lines of text below the <blah action>
so it will be like :

<foo1 *.html>
<blah action>
param1 off
param2 off
somthing 1
somthing 2
</blah>
</foo1 >

i need to be able to insert it all across the text file .
i know i can do search and replace in vi with
%s/action\>$/.........../g

but i don't know how to tell the replace command to insert line brakes ( i think this is what i need)
Reply With Quote
Forum Sponsor
  #2  
Old 06-08-2006
Registered User
 

Join Date: Jan 2005
Posts: 682
Code:
:%s/action\>$/&^M........../
Where ^M is entered by first entering [Control-V] and then [Control-M].
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:45 PM.


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

Content Relevant URLs by vBSEO 3.2.0