CharlieMac
Technical User
I am pretty new to awk and have run into a wall. I have the following input file:
23:59:36 2002 BDDDY 4 2 1 5
23:59:36 2002 BDDDY 4 1 0
23:59:36 2003 BDDDY 4 0 4 13
23:59:36 2003 BDDDY 13 0 0
23:59:36 2004 BDDDY 55 24 20 180
23:59:36 2004 BDDDY 157 23 0
23:59:36 2005 BDDDY 10132 5909 2177 31197
23:59:36 2005 BDDDY 17343 13854 0
23:59:36 2006 BDDDY 8177 5484 7598 27272
23:59:36 2006 BDDDY 14727 12545 0
23:59:36 2007 BDDDY 2459 1367 0 9219
23:59:36 2007 BDDDY 5339 3880 0
23:59:36 2705 BDDDY 1409 702 0 7765
23:59:36 2705 BDDDY 4700 3065 0
23:59:36 2706 BDDDY 4856 2590 0 18078
23:59:36 2706 BDDDY 10844 7234 0
23:59:36 2707 BDDDY 0 0 0 0
23:59:36 2707 BDDDY 0 0 0
what I would like to parse this to make it look like
23:59:36 2002 BDDDY 4 2 1 5 4 1 0
23:59:36 2003 BDDDY 4 0 4 13 13 0 0
23:59:36 2004 BDDDY 55 24 20 180 157 23 0
As you can kind of see it would be all the first line and the last 3 fields of the second line.
any help would be great I have tried the following awk script:
BEGIN {
FS="\n"
RS=""
}
{
print $1 " " $2
}
Granted the output is not perfect but it is workable but it only does the first 2 lines with an output of:
23:59:36 2002 BDDDY 4 2 1 5 23:59:36 2002 BDDDY 4 1 0
only and none of the other lines.
Any help would be GREATLY appreciated.
23:59:36 2002 BDDDY 4 2 1 5
23:59:36 2002 BDDDY 4 1 0
23:59:36 2003 BDDDY 4 0 4 13
23:59:36 2003 BDDDY 13 0 0
23:59:36 2004 BDDDY 55 24 20 180
23:59:36 2004 BDDDY 157 23 0
23:59:36 2005 BDDDY 10132 5909 2177 31197
23:59:36 2005 BDDDY 17343 13854 0
23:59:36 2006 BDDDY 8177 5484 7598 27272
23:59:36 2006 BDDDY 14727 12545 0
23:59:36 2007 BDDDY 2459 1367 0 9219
23:59:36 2007 BDDDY 5339 3880 0
23:59:36 2705 BDDDY 1409 702 0 7765
23:59:36 2705 BDDDY 4700 3065 0
23:59:36 2706 BDDDY 4856 2590 0 18078
23:59:36 2706 BDDDY 10844 7234 0
23:59:36 2707 BDDDY 0 0 0 0
23:59:36 2707 BDDDY 0 0 0
what I would like to parse this to make it look like
23:59:36 2002 BDDDY 4 2 1 5 4 1 0
23:59:36 2003 BDDDY 4 0 4 13 13 0 0
23:59:36 2004 BDDDY 55 24 20 180 157 23 0
As you can kind of see it would be all the first line and the last 3 fields of the second line.
any help would be great I have tried the following awk script:
BEGIN {
FS="\n"
RS=""
}
{
print $1 " " $2
}
Granted the output is not perfect but it is workable but it only does the first 2 lines with an output of:
23:59:36 2002 BDDDY 4 2 1 5 23:59:36 2002 BDDDY 4 1 0
only and none of the other lines.
Any help would be GREATLY appreciated.