Hi all,
Just wondering if there's a way to write the following command in just one awk call:
#!/bin/sh
...
awk '{printf "%s" (NR%5 ? "\t" : "\n"),$0}' | awk 'BEGIN{OFS="\t"} {print "'"$1"'", "'"$2"'", $2, $1, $3, $4, $5, "'"`date +%d\/%m\/%Y\ %H:%M:%S`"'", ""}'
...
stdout=
27/07/07
92410
AnyText_1.
Blah_1
92410
16/07/07
92410
AnyText_2.
Blah_2
92410
16/07/07
92410
AnyText_3.
Blah_3
92410
Desired output= (tab delimited)
9756-R2 555 8N01076123426 92410 27/07/07 AnyText_1. Blah_1 92410 08/08/2007 12:35:23
9756-R2 555 8N01076123426 92410 16/07/07 AnyText_2. Blah_2 92410 08/08/2007 12:35:23
9756-R2 555 8N01076123426 92410 16/07/07 AnyText_3. Blah_3 92410 08/08/2007 12:35:23
Thank you
clem
OS X.4.10
Just wondering if there's a way to write the following command in just one awk call:
#!/bin/sh
...
awk '{printf "%s" (NR%5 ? "\t" : "\n"),$0}' | awk 'BEGIN{OFS="\t"} {print "'"$1"'", "'"$2"'", $2, $1, $3, $4, $5, "'"`date +%d\/%m\/%Y\ %H:%M:%S`"'", ""}'
...
stdout=
27/07/07
92410
AnyText_1.
Blah_1
92410
16/07/07
92410
AnyText_2.
Blah_2
92410
16/07/07
92410
AnyText_3.
Blah_3
92410
Desired output= (tab delimited)
9756-R2 555 8N01076123426 92410 27/07/07 AnyText_1. Blah_1 92410 08/08/2007 12:35:23
9756-R2 555 8N01076123426 92410 16/07/07 AnyText_2. Blah_2 92410 08/08/2007 12:35:23
9756-R2 555 8N01076123426 92410 16/07/07 AnyText_3. Blah_3 92410 08/08/2007 12:35:23
Thank you
clem
OS X.4.10