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 and shell scripting languages 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 9 06-08-2009 07:11 AM
Perl: Search for string on line then search and replace text Crypto Shell Programming and Scripting 4 01-04-2008 10:24 AM
Insert line break in vi's command mode Skogsmulle UNIX for Dummies Questions & Answers 3 07-06-2007 11:47 AM
String Search & Replace IwishIknewC UNIX for Dummies Questions & Answers 1 03-25-2006 06:28 AM
string search replace krishna UNIX for Advanced & Expert Users 1 12-19-2001 01:49 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-08-2006
umen umen is offline
Registered User
  
 

Join Date: Aug 2005
Posts: 239
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)
  #2 (permalink)  
Old 06-08-2006
tmarikle tmarikle is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2005
Posts: 683

Code:
:%s/action\>$/&^M........../

Where ^M is entered by first entering [Control-V] and then [Control-M].
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:57 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0