From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Carl Christopher Bavington @ Langley" Newsgroups: gmane.os.tru64.managers Subject: SUMMARY: sed append a\ problem. Date: Tue, 25 Feb 2003 18:13:02 +0000 Sender: tru64-unix-managers-owner@ornl.gov Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Trace: main.gmane.org 1046196834 6322 80.91.224.249 (25 Feb 2003 18:13:54 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 25 Feb 2003 18:13:54 +0000 (UTC) Return-path: Original-Received: from sws1.ctd.ornl.gov ([160.91.22.101]) by main.gmane.org with smtp (Exim 3.35 #1 (Debian)) id 18njZu-0001bO-00 for ; Tue, 25 Feb 2003 19:13:19 +0100 Original-Received: (qmail 27787 invoked by uid 5); 25 Feb 2003 18:13:23 -0000 Original-Followup-To: poster Precedence: bulk Original-Received: (qmail 27772 invoked by uid 49493); 25 Feb 2003 18:13:23 -0000 Original-Received: from Carl.Bavington@ntl.com by sws1 by uid 49491 with qmail-scanner-1.14 (clamscan: 0.54. spamassassin: 2.50-cvs. Clear:SA:0(-1.1/5.0):. Processed in 0.566929 secs); 25 Feb 2003 18:13:23 -0000 Original-Received: from unknown (HELO emroute1.cind.ornl.gov) (160.91.4.119) by 0 with SMTP; 25 Feb 2003 18:13:22 -0000 Original-Received: from emroute1.cind.ornl.gov (localhost [127.0.0.1]) by emroute1.cind.ornl.gov (PMDF V6.1-1 #30669) with ESMTP id <0HAV00E24MM65E@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Tue, 25 Feb 2003 13:13:22 -0500 (EST) Original-Received: from mast-dc0-sm01.private.ntl.com (cabletel1.cableol.net [194.168.3.4]) by emroute1.cind.ornl.gov (PMDF V6.1-1 #30669) with ESMTP id <0HAV00E23MM25K@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Tue, 25 Feb 2003 13:13:15 -0500 (EST) Original-Received: from mast-dc0-se03.private.ntl.com (unverified) by mast-dc0-sm01.private.ntl.com (Content Technologies SMTPRS 4.2.10) with ESMTP id for ; Tue, 25 Feb 2003 18:13:12 +0000 Original-Received: by mast-dc0-se03.private.ntl.com with Internet Mail Service (5.5.2653.19) id ; Tue, 25 Feb 2003 18:13:12 +0000 Content-return: allowed Original-To: "Tru64 Managers Mail Group \(E-mail\)" X-Mailer: Internet Mail Service (5.5.2653.19) Xref: main.gmane.org gmane.os.tru64.managers:3441 X-Report-Spam: http://spam.gmane.org/gmane.os.tru64.managers:3441 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 @ Langley [mailto:Carl.Bavington@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