[rescue] Help w/ computer time??
Greg A. Woods
woods at weird.com
Wed Apr 24 14:28:55 CDT 2002
[ On Wednesday, April 24, 2002 at 13:47:15 (-0500), Jonathan C. Patschke wrote: ]
> Subject: Re: [rescue] Help w/ computer time??
>
> for i in `cat filename` ; do
> echo -n $i ' '
> echo $i | gawk '{print strftime("%a %b %d %H:%M:%S %Z %Y", $1)}'
> done
I really hate to do this, but you're _really_ asking for it these days:
That's such horrible inefficient and poorly designed code it almost made
me puke no my keyboard! (well not literally, but it's sure making me
spew my thoughts through my keyboard and into this message! :-)
PLEASE learn to use your tools properly if you're going to provide
examples for others.
The following example uses gawk much more correctly and almost
infinitely more efficiently:
gawk '{print strftime("%a %b %d %H:%M:%S %Z %Y", $0}' < filename
Even if you really had to invoke whatever tool to do the job once for
every value, you should NEVER try to put all the values on one 'for'
statement in shell code. Use 'read', PLEASE!
You should also never use 'cat' unnecessarily. Use redirection!!!!
while read value ; do
date -r $value
done < filename
PLEASE try at least a little bit harder next time! :-)
(even as a troll your post was a poor example!)
--
Greg A. Woods
+1 416 218-0098; <gwoods at acm.org>; <g.a.woods at ieee.org>; <woods at robohack.ca>
Planix, Inc. <woods at planix.com>; VE3TCP; Secrets of the Weird <woods at weird.com>
More information about the rescue
mailing list