Re: sed/awk - columns to rows for a data series
- From: William James <w_a_x_man@xxxxxxxxx>
- Date: 11 May 2007 11:15:42 -0700
On May 11, 11:26 am, "Banzai" <ban...@xxxxxxx> wrote:
Hello All
I have a data series, thus:
========== Tue May 8 00:24:59 BST 2007
ACTIVE SMP 2
ACTIVE SYS 1
ACTIVE 15
INACTIVE DBSNMP 1
INACTIVE JSECURE 5
INACTIVE SMP 15
SNIPED JSECURE 14
SNIPED SMP 7
========== Tue May 8 00:30:00 BST 2007
ACTIVE SMP 3
ACTIVE SYS 1
ACTIVE 15
INACTIVE DBSNMP 1
INACTIVE JSECURE 7
INACTIVE SMP 11
SNIPED JSECURE 1
SNIPED SMP 7
========== Tue May 8 00:35:00 BST 2007
ACTIVE SMP 2
ACTIVE SYS 2
ACTIVE 15
INACTIVE DBSNMP 1
INACTIVE JSECURE 8
INACTIVE SMP 11
SNIPED JSECURE 3
SNIPED SMP 5
Can somebody help me to parse the file so that I have the output like:
00:24:59 2 1 15 1 5 15 14 7
00:30:00 3 1 15 1 7 11 1 7
00:35:00 2 2 15 1 8 11 3 5
Formatting /spacing not important as long as the sense is correct (it can be space or tab or csv delimitted) - i need to sunsequently import the series into excel.
Thanks In advance
ruby -r enumerator -e 'puts ARGF.readlines.map{|s|
s[/..:..:..|\S+$/]}.enum_slice(9).to_a.map{|a|
a.join(" ")}' thefile
.
- Follow-Ups:
- Re: sed/awk - columns to rows for a data series
- From: Banzai
- Re: sed/awk - columns to rows for a data series
- References:
- sed/awk - columns to rows for a data series
- From: Banzai
- sed/awk - columns to rows for a data series
- Prev by Date: Re: Ksh output garbled/out-of-sync
- Next by Date: Re: sort command: default record size
- Previous by thread: Re: sed/awk - columns to rows for a data series
- Next by thread: Re: sed/awk - columns to rows for a data series
- Index(es):
Relevant Pages
|