Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

How to replace actual generated date with sysdate?

Shell Programming and Scripting


Tags
shell bash ksh

Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 02-28-2013
jediwannabe jediwannabe is offline
Registered User
 
Join Date: Nov 2012
Last Activity: 30 December 2014, 9:28 PM EST
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 Unix and Linux 02-28-2013
Subbeh Subbeh is offline
Registered User
 
Join Date: May 2011
Last Activity: 3 March 2016, 7:23 AM EST
Posts: 332
Thanks: 37
Thanked 87 Times in 86 Posts
With sed:

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

Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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 11:06 AM
Need help in Shell Script comparing todays date with Yesterday date from Sysdate kumarmsk1331 Shell Programming and Scripting 0 07-29-2011 05:49 PM
Open the file and replace the variable with actual value bharathappriyan Shell Programming and Scripting 3 08-02-2010 03:01 PM
Need a script to Append date to generated .txt file prince_of_focus Shell Programming and Scripting 2 08-01-2006 03:51 PM
How to FTP fiels according to generated date maheshsri Shell Programming and Scripting 0 05-03-2006 03:06 PM



All times are GMT -4. The time now is 11:24 AM.