The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
[help]Delete or replace text in multiple file and multiple directory dzufauzan Shell Programming and Scripting 16 06-05-2009 11:07 AM
replace multiple lines in file nox Shell Programming and Scripting 2 08-18-2008 08:44 AM
Adding Multiple Lines to Multiple Files dayinthelife Shell Programming and Scripting 2 06-04-2008 11:50 AM
using sed command to replace multiple lines radha.kalivar Shell Programming and Scripting 1 07-10-2007 10:36 AM
How can I replace multiple lines from different files ranga27 Shell Programming and Scripting 2 02-07-2007 08:57 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-21-2008
unihp1 unihp1 is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 5
replace multiple lines in multiple files

i have to search a string and replace with multiple lines.

example

Input

echo 'sample text'
echo 'college days'

output
echo 'sample text'
echo 'information on students'
echo 'emp number'
echo 'holidays'



i have to search a word college and replace the multiple lines
i have lot of files to search and replace

Please help me on this...
  #2 (permalink)  
Old 09-21-2008
demhyt demhyt is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 13
i think sed can solve your problem...

$cat file1.txt
one
two
three
four
five

$sed '3a
>testing
>again' file1.txt
one
two
three
testing
again
four
five

$

3a mean line3..in the line 4 and line 5 inserted the text testing and again...you can open gnulamp.com and search the sed tutorial...
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 09:41 AM.


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