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 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 2 04-11-2008 11:32 AM
replace string in XML with sed chiru_h Shell Programming and Scripting 6 04-09-2008 04:49 PM
replace string sam99 Shell Programming and Scripting 4 03-03-2008 10:39 PM
replace a string melanie_pfefer Shell Programming and Scripting 11 01-17-2008 07:57 AM
Replace string B depending on occurence of string A hemangjani Shell Programming and Scripting 1 12-05-2006 02:10 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 01-22-2008
Registered User
 

Join Date: Dec 2007
Posts: 14
Smile SED Replace String Help

I have to replace date in Control file every day i run the script
control file looks like this

$cat pharma.ctl
LOAD DATA
INFILE '/usr/bin/sqlscripts/SQL.PharmID.20071206.txt'
INTO TABLE uname.TEMP_TABLE
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS
(col_names)

i tried
$sed -e s/SQL.PharmID.[0-9]*.txt/SQL.PharmID.`date +%Y%m%d`.txt pharma.ctl>pharma.ctl
Command Garbled

can someone give me the right command
Reply With Quote
Forum Sponsor
  #2  
Old 01-22-2008
Registered User
 

Join Date: Dec 2007
Posts: 14
Thumbs up Solved

DD=SQL.PharmID.`date +%Y%m%d`.txt
echo $DD
sed -e 's/SQL.PharmID.[0-9]*.txt/'$DD'/g' CONTROLFILE.ctl > CONTROLFILE.ctl.new
Reply With Quote
  #3  
Old 01-22-2008
Registered User
 

Join Date: Jun 2007
Location: Beijing China
Posts: 495
sed

Hi,

Code:
sed "s/SQL\.PharmID\.[0-9]*/SQL\.PharmID\.`date +%Y%m%d`/" filename
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:23 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0