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 > 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
Regular Expressions ramky79 UNIX for Advanced & Expert Users 3 05-21-2008 05:13 PM
Help with regular expressions arushunter Shell Programming and Scripting 13 12-24-2006 12:31 AM
regular expressions jack1981 Shell Programming and Scripting 4 07-12-2006 03:10 PM
regular expressions in c++ szzz High Level Programming 2 10-06-2003 10:33 AM
Regular Expressions AresMedia Shell Programming and Scripting 1 08-22-2002 03:55 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 02-10-2002
mfreemantle mfreemantle is offline
Registered User
  
 

Join Date: Feb 2002
Location: Sydney, Australia
Posts: 3
Question Regular expressions in sed

I'm using sed to alter a parameter file used in another process. Basically, the file is a template containing a few variables which need to be replaced at runtime.

The problem is that using sed with filenames that contain the / character causes matches to fail.

eg:
fileName=/mnt/someinputfile
sed -e "s/param1/${fileName}/g" somefile.txt > runfile

Could someone suggest how I can get around this?

Also, anyone know a good site for regexp?

=====================================
I've also tried doing an escaped forward slash substitution. ie. replace all "/" with "\\\/". It works outside the shell, but not inside. Wierd.

Here's the code fragment:

Code:
# 2 Modify the runCSjob.xml file: output to jobFile
subRunDate=`echo ${runDate}|sed -e "s/\//\\\\\//g"`;
substituteRunDate="1,\$s/\\\${runDate}/${subRunDate}/g";
subOutputFile=`echo ${outputFile}|sed -e "s/\//\\\\\//g"`;
substituteOutputFile="1,\\\$s/\${outputFile}/${subOutputFile}/g"
substituteRunType="1,\$s/\${runType}/${runType}/g";
sed -e "${substituteRunDate}" -e "${substituteOutputFile}" -e "${substituteRunType}" ${UTOPIA_BIN}/runCSjob.xml > ${tmpFile}.xml
Ideas??

Last edited by mfreemantle; 02-10-2002 at 10:21 PM..
 

Bookmarks

Tags
regex, regular expressions

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 10:05 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