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
Search, replace string in file1 with string from (lookup table) file2? gstuart Shell Programming and Scripting 9 06-08-2009 06:11 AM
replace string in XML with sed chiru_h Shell Programming and Scripting 6 04-09-2008 07:49 PM
replace string sam99 Shell Programming and Scripting 4 03-04-2008 01:39 AM
replace a string melanie_pfefer Shell Programming and Scripting 11 01-17-2008 10:57 AM
Replace string B depending on occurence of string A hemangjani Shell Programming and Scripting 1 12-05-2006 05:10 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 01-22-2008
prash184u prash184u is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 23
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
  #2 (permalink)  
Old 01-22-2008
prash184u prash184u is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 23
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
  #3 (permalink)  
Old 01-23-2008
summer_cherry summer_cherry is offline Forum Advisor  
Registered User
  
 

Join Date: Jun 2007
Location: Beijing China
Posts: 1,078
sed

Hi,

Code:
sed "s/SQL\.PharmID\.[0-9]*/SQL\.PharmID\.`date +%Y%m%d`/" filename
Sponsored Links
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 03:40 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