sed help please

From: Theresa Sarver (tsarver.IFMC@SDPS.ORG)
Date: Wed Feb 12 2003 - 12:26:03 EST


Hi all;

I have script almost finished however 1 little aspect has me stumped - would someone be so kind as to provide me with a little help.

This is what my infile looks like (performance toolbox data):

^L"#Monitor: xmservd recording --- hostname: c2f1n1ex"
"Timestamp" "PagSp/totalfree" "PagSp/totalsize" "Mem/Virt/pageout" "Mem/Virt/pag
ein" "Mem/Real/%free" "Mem/Real/numfrb" "CPU/cpu3/idle" "CPU/cpu2/idle" "CPU/cpu
1/idle" "CPU/cpu0/idle"
"2003/01/30 07:04:01" 474683 524288 3 13 0.9 226
2 98.3 98.2 98.2 98.1
"2003/01/30 07:09:01" 474683 524288 6 0 1.0 284
2 94.7 98.2 96.7 98.2
"2003/01/30 07:14:01" 474683 524288 4 0 1.0 276
4 99.6 99.2 98.2 98.9

This is what my CURRENT outfile looks like:

2003/01/30 7:04:01,474683,524288,3,13,0.9,2262,98.3,98.2,98.2,98.1
2003/01/30 07:09:01,474683,524288,6,0,1.0,2842,94.7,98.2,96.7,98.2
2003/01/30 07:14:01,474683,524288,4,0,1.0,2764,99.6,99.2,98.2,98.9
2003/01/30 07:19:01,474683,524288,3,0,1.0,2549,99.6,99.7,98.2,99.5
2003/01/30 07:24:01,474683,524288,2,0,1.0,2539,99.5,99.8,98.3,99.8

Here is what I have so far for a script:

sed -e "s!\"!!g
        /[A-Za-z]\{1,\}.*/d
        s? \{3,\}?,?g" infile > outfile

I need to have the hostname added to every line of output, however, the hostname only appears 1x at the top of the infile and is not repeated (as all the other fields are) on everyline of data.

Please help, I'm running out of hair to pull out!

Thanks;
Theresa



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:35 EDT