Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insertng date in output records 1

Status
Not open for further replies.

rufflocks

Technical User
Jun 29, 2001
26
US
I want to use awk to insert system date in a pipe-delimited file, so the output looks like:
firstname|lastname|20021203|address

The other fields of records in the file is created by the same awk script.

Thanks for any ideas?
 
BEGIN {
FS=OFS="|"
insertField="3"
dateCMD="date '+%Y%m%d'"
}

{
dateCMD | getline dateNow
close(dateCMD);
$3=dateNow OFS $3
print
}
vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top