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
mv Filename variable to another filename gzs553 Shell Programming and Scripting 3 04-14-2008 05:19 PM
shortcut for tar cvf - [filename] | gzip > [filename].tar.gz bcamp1973 UNIX for Dummies Questions & Answers 4 12-11-2007 05:45 PM
how to read double consecutive space in filename for bash shell james_falco UNIX for Dummies Questions & Answers 1 07-17-2007 05:32 PM
Unix shell script (grep -A 6 -B 2 "ORA-" filename el_guero Shell Programming and Scripting 7 04-25-2007 06:37 PM
How to send filename as variable in a shell script gthokala9 Shell Programming and Scripting 6 06-27-2006 02:23 PM

 
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 06-28-2004
eadie eadie is offline
Registered User
  
 

Join Date: Jun 2004
Posts: 3
sed / shell - how to use $filename

I've forgotten how to use a filename parameter
using sed inside a shell script. What I want to do is
replace a string inside a file with the name of
the file being processed.

I think this should work ..

for filename do
sed -e "s/xxx/$filename/" ...
...
done

Thanks!

Ps: i.e. I want to change

We need to put xxx in the answer.

into

We need to put filename in the answer.
 

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 11:59 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