SUMMARY: sed append a\ problem.

From: Carl Christopher Bavington _at_ Langley <Carl.Bavington_at_ntl.com>
Date: Tue, 25 Feb 2003 18:13:02 +0000

I was barking up the wrong tree with sed.

sed has't any builtin macro to get current date, so it has to get it from
environment/command line, i.e., you have to execute "date" (which means a
new "sed") for every line, and you end up with a loop. Cheers J.A.Gutierrez,
you're correct.

        Several people suggested awk variations like :

|awk '{printf("%s",$0); system("date");}'

But i went for the below for the simplier date format, cheers to Michael
Bradford for the body

        #!/bin/ksh

touch ./VMSTAT_OUTPUT
vmstat 2 700 | while read LINE
do
echo " `date +\"%D %T\" ` $LINE" >> ./VMSTAT_OUTPUT
done



-----Original Message-----
From: Carl Christopher Bavington _at_ Langley
[mailto:Carl.Bavington_at_ntl.com]
Sent: 25 February 2003 14:31
To: Tru64 Managers Mail Group (E-mail)
Subject: sed append a\ problem.


Managers,

I'm wanting to get vmstat to include the date, which is not a flag. I'm
trying not to stick it in a loop with an echo date etc, but instead have a
vmstat 5 720 (every 5 seconds for an hour). been piped into sed and
appending the date. to each line.

I'm having no luck with the syntax, any help much appreciated.

Cheers,

Carl Bavington
Senior Technical Analyst (CAS)
Tel: 01753 45(2082)
ntl



The contents of this email and any attachments are sent for the personal
attention
of the addressee(s) only and may be confidential. If you are not the
intended
addressee, any use, disclosure or copying of this email and any attachments
is
unauthorised - please notify the sender by return and delete the message.
Any
representations or commitments expressed in this email are subject to
contract.
 
ntl Group Limited


The contents of this email and any attachments are sent for the personal attention
of the addressee(s) only and may be confidential. If you are not the intended
addressee, any use, disclosure or copying of this email and any attachments is
unauthorised - please notify the sender by return and delete the message. Any
representations or commitments expressed in this email are subject to contract.
 
ntl Group Limited
Received on Tue Feb 25 2003 - 18:13:54 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:44 NZDT