Hi, I have the following one liner which works great in a shell script.  I have a 
comma delimited text file with the same number of rows.  
I want to add the date in YYYY-MM-DD format to every line...

I was doing this..  
cat $file | awk '{print $0 "," "'$fdate'"}' >>$new_file

Works great

Unfortunately when I add that to perl in backticks for the system to execute,
It blows up on the quotes between $0 (the whole line), the comma, and the date 
variable.

In perl, I know I could do...
$fdate=`date 
open (FILE, ">/newfile");
@file=`cat $oldfile`
foreach $item(@file) {
chomp $item;
print FILE "$item,$fdate\n";
}
close (FILE);

However, it seems like such a waste to turn an elegant one line into 8 lines of code

So how can I make that one liner work, I've tried backslashing the quotes, using 
single quotes, and everytime awk blows up at me?
Thanks much,
Taylor

Taylor Lewick
Unix System Administrator
Fortis Benefits
816 881 6073

"Help Wanted.  Seeking Telepath..."
"You Know where to apply."

****************************************************************
                        Please Note
The information in this E-mail message is legally privileged
and confidential information intended only for the use of the
individual(s) named above. If you, the reader of this message,
are not the intended recipient, you are hereby notified that 
you should not further disseminate, distribute, or forward this
E-mail message. If you have received this E-mail in error,
please notify the sender. Thank you
*****************************************************************

Reply via email to