On Monday, May 20, 2002, at 01:07 , Ovid wrote:
>> 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 [..] too many letters to type [..] > If you're trying to do this in a one-liner, pure Perl (assuming that I > understood your question > correctly), the the following should do the trick: > > $ perl -p -e > '@t=localtime;$t[4]++;$t[5]+=1900;s/$/sprintf(",%4d-%02d-%02d",@t[5,4,3])/e' > oldFile.txt >> newFile.txt uh doods, am I missing something here? Why not make it a command that creates a new file given an old file..... I can appreciate the expediency thing of whipp it out on the command line - once. but if this is some sort of hobbit that one is going to troll around, why not code it and be done with? http://www.wetware.com/drieux/pbl/Sys/Admin/parsingFileFromOneToAnother.txt ok, so maybe parsingFileFromOneToAnother /tmp/drieux/Junk.File - | tee /tmp/drieux/Other.File is not as chic as say parsingFileFromOneToAnother /tmp/drieux/Junk.File /tmp/drieux/Other.File but it is also fun to show how that can be worked into the mix ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]