Monday, September 10, 2007

Need formatting in output

$ cat fil2
090607:The rest of the line
091207:Also some text
091207:Here's some more text

[Output required]
06-09-07:The rest of the line
12-09-07:Also some text
12-09-07:Here's some more text

SED solution:
$ sed -e "s/^\(..\)\(..\)\(.*\)/\2-\1-\3/g" fil2

PERL solution:
open(FILE, "$ARGV[0]");

# replace [ by <> below
print $_;

No comments:

© Jadu Saikia