omega_grey wrote:
Don't I feel like a dork. No wonder why I couldn't find anything. Awk you
say. Will look into it but someone else has suggested I use PERL for this.
Sigh.

Perl would probably work also. grep is for finding strings, it doesn't manipulate them. sed/awk do both, sed is mostly for string/regex replacements, awk is more of a programming language (and also tends to work more with fields, where sed is more line-based). Perl is a flat-out programming language, though somewhat similar to awk in that it has easy input handling (compared to e.g. C/C++).

Hmm... if you have *just* the string "12/01/08" (meaning Jan 12), you can convert it with 'date' like: echo "12/01/08" | sed 's,([0-9]+)/([0-9]+)/([0-9]+),\2/\1/\3,' | xargs -n 1 date '+%Y-%m-%d' -d

...which has the advantage of understanding the input as an actual date. Replace the 'echo' with anything generating "#/#/#" dates, one per line. You should be able to do something similar with times. ('date -d' might be locale-dependent, or I might be wrong about your month/day order; if so, omit the sed part of the pipe.)

--
Matthew
Please do not quote my e-mail address unobfuscated in message bodies.
--
Time is an illusion. Lunchtime doubly so. -- Ford Prefect (Douglas Adams' HHGttG)



Reply via email to