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 > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Compare date from db2 table to yesterday's Unix system date sasaliasim Shell Programming and Scripting 9 12-01-2008 11:37 PM
using system date in awk Manish4 UNIX for Dummies Questions & Answers 1 11-18-2008 03:23 AM
awk system date with -d option arag0rn Shell Programming and Scripting 3 01-05-2008 03:23 PM
system date Prafulla UNIX for Dummies Questions & Answers 1 02-01-2002 06:42 AM
file date vs. system date ober5861 UNIX for Dummies Questions & Answers 8 09-11-2001 02:36 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-19-2008
Manish4 Manish4 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 5
Unhappy Use of system date in awk

i'm facing problems in using system date in a awk script...
it should display the date in a report in mm/dd/yy format..
please help me in this case..

thanks
  #2 (permalink)  
Old 11-19-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
What problems are you having? Show us your code and any error message(s).
  #3 (permalink)  
Old 11-19-2008
Manish4 Manish4 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 5
use of system date in awk

This is the code i'm using but it is not displayin the date in the report.

BEGIN {
var_hdr3 = "REPORT RUN DATE"
var_date = "date +%m/%d/%Y"
printf "%s %s\n",var_hdr3 ,var_date;

exit 0;
}
  #4 (permalink)  
Old 11-19-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
In that code awk has no way of knowing that "REPORT RUN DATE" is a string, but "date +%m/%d/%Y" is a command, so you need to handle them differently.

Try this:

Code:
"date +%m/%d%y" | getline var_date
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 04:02 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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