How to replace actual generated date with sysdate? | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

How to replace actual generated date with sysdate?

Shell Programming and Scripting


Tags
shell bash ksh

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-28-2013
jediwannabe jediwannabe is offline
Registered User
 
Join Date: Nov 2012
Last Activity: 30 September 2014, 12:07 AM EDT
Posts: 50
Thanks: 6
Thanked 0 Times in 0 Posts
How to replace actual generated date with sysdate?

Hi,

currently I've a file with the following content:


Code:
insert into CD_CARD_TYP (code, description, last_update_by, last_update_date)
values ('024', '024', 2, to_date('29-03-2008 05:16:09', 'dd-mm-yyyy hh24:mi:ss'));
insert into CD_CARD_TYP (code, description, last_update_by, last_update_date)
values ('032', '032', 2, to_date('24-04-2008 05:17:30', 'dd-mm-yyyy hh24:mi:ss'));
insert into CD_CARD_TYP (code, description, last_update_by, last_update_date)
values ('034', '034', 2, to_date('24-04-2008 05:17:30', 'dd-mm-yyyy hh24:mi:ss'));

I need to replace the date with SYSDATE, i.e.



Code:
insert into CD_CARD_TYP (code, description, last_update_by, last_update_date)
values ('024', '024', 2, sysdate);
insert into CD_CARD_TYP (code, description, last_update_by, last_update_date)
values ('032', '032', 2, sysdate);
insert into CD_CARD_TYP (code, description, last_update_by, last_update_date)
values ('034', '034', 2, sysdate);

how do I change the above?

thanks a lot!
Sponsored Links
    #2  
Old 02-28-2013
Subbeh Subbeh is offline
Registered User
 
Join Date: May 2011
Last Activity: 24 October 2014, 10:03 AM EDT
Posts: 328
Thanks: 35
Thanked 86 Times in 85 Posts
With sed:

Code:
sed 's/to_date([^)]*)/sysdate/' filename

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Replace a pattern in a file with a generated number using sed or awk vivek d r Shell Programming and Scripting 13 06-20-2012 10:06 AM
Need help in Shell Script comparing todays date with Yesterday date from Sysdate kumarmsk1331 Shell Programming and Scripting 0 07-29-2011 04:49 PM
Open the file and replace the variable with actual value bharathappriyan Shell Programming and Scripting 3 08-02-2010 02:01 PM
Need a script to Append date to generated .txt file prince_of_focus Shell Programming and Scripting 2 08-01-2006 02:51 PM
How to FTP fiels according to generated date maheshsri Shell Programming and Scripting 0 05-03-2006 02:06 PM



All times are GMT -4. The time now is 05:28 AM.