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
shell script to find and replace string in multiple files pharos467 Shell Programming and Scripting 11 01-15-2009 11:40 AM
Find and Replace NycUnxer UNIX for Dummies Questions & Answers 4 03-06-2008 12:20 AM
Find and Replace in multiple files (Shell script) jatins_s Shell Programming and Scripting 13 11-05-2007 02:11 PM
find and replace in XML wip_vasikaran UNIX for Dummies Questions & Answers 2 09-27-2007 01:16 PM
improving my script bcheaib Shell Programming and Scripting 6 07-15-2004 11:59 AM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 12-11-2003
amir_yosha amir_yosha is offline
Registered User
  
 

Join Date: Dec 2003
Posts: 4
Question improving my script (find & replace)

Hi all,
I have a script that scan files, find old templet and replace it with new one.

#!/bin/ksh
file_name=$1
old_templet=$2
new_templet=$3

# Loop through every file like this
for file in file_name
do
cat $file | sed "s/old_templet/new_templet/g" > $file.new
#do a global searce and replace and put the results
mv $file.new $file
#rename $file.new to original name of file
done


How can I replace the old templet with few rows templet ?
for example:
the old templet =
xxxx
the new templet =
yyyy
zzzz

<script_name> <file_name> xxxx yyyy??zzzz

What has to be instead the ?? in order to split the yyyy and zzzz for tow separate rows ?

10x
Amir
 

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 06:26 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