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
convert date format YYYYMMDD to MM/DD/YYYY nasirgondal Shell Programming and Scripting 8 04-08-2009 10:56 AM
Change Date from dd-mmm-yyyy to mm/dd/yyyy stringzz Shell Programming and Scripting 9 09-15-2008 10:09 AM
create filename with 'DD/MM/YYYY' date format royalibrahim Shell Programming and Scripting 4 04-12-2008 08:24 AM
Date Vadidation in YYYY-MM-DD itsmehihihi Shell Programming and Scripting 1 07-22-2007 09:22 PM
convert mmddyy date format to ccyyddd format?? Bhups Shell Programming and Scripting 2 09-27-2006 11:30 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 02-15-2007
sars sars is offline
Registered User
  
 

Join Date: Oct 2006
Posts: 19
sed to display date in dd/mm/yyyy format

Hi

I have a sed command

HTML Code:
sed -e "s/sub_date/=$(date  +"%d/%m/%Y")/" sub_create_tmp
I want to substitute with the current date in dd/mm/yyyy format .
But the result is an error " cannot parse " .

Pls help .

sars
  #2 (permalink)  
Old 02-15-2007
sars sars is offline
Registered User
  
 

Join Date: Oct 2006
Posts: 19
Resolved

ok ..
i change the delimiter from "/" to "," (comma) .
It worked .
sars
  #3 (permalink)  
Old 02-15-2007
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Quote:
Originally Posted by sars
HTML Code:
sed -e "s/sub_date/=$(date  +"%d/%m/%Y")/" sub_create_tmp
A kludge
Code:
sed -e "s/sub_date/=$(date +\"%d%m%Y\")/"  -e "s/\(.*\)=\"\(..\)\(..\)\(....\)\"\(.*\)/\1=\2\/\3\/\4\5/" sub_create_tmp
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 09:03 PM.


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