The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Appending the line number and a seperator to each line of a file ? pjcwhite Shell Programming and Scripting 4 03-21-2007 01:29 AM
appending to sed output of one file into the middle of file go4desperado Shell Programming and Scripting 5 02-05-2007 02:20 AM
Appending data at the first and last line of a file brainstormer Shell Programming and Scripting 4 01-03-2007 10:38 AM
Capturing shell script command output designflaw Shell Programming and Scripting 2 03-01-2006 04:24 PM
capturing output in script MizzGail Shell Programming and Scripting 6 06-02-2004 08:44 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 08-30-2007
wally_welder's Avatar
wally_welder wally_welder is offline
Registered User
  
 

Join Date: Aug 2007
Location: Dongen, Netherlands
Posts: 2
capturing line from script output and appending to a file

Hi all,
I did some searching in this forum but can't find anything that matches the issue I'm bumping heads with.

On a CentOS4/Postfix (and bash everywhere) mail gateway box I run a command periodically to purge the Postfix queue of messages "From:MAILER-DAEMON".

This is the one line'r (courtesy of the Postfix list archives)

Code:
mailq | grep -v "^[^0-9A-Z]+" | grep MAILER-DAEMON | awk '{print $1}' | postsuper -d -
This generates output exactly as shown:
[many preceding lines of exactly the same format]
postsuper: E657736C82BD: removed
postsuper: E1CAD36C8074: removed

and finally, at the end of the output:
postsuper: Deleted: 127 messages

What I'm trying to figure out how to do is this.....
Grab the number of deleted messages, and append them to a file with a timestamp e.g. 20070830 07:32 - 127

so somewhere in the latter end of this would be >> cron_purges

Can anyone help me understand how to grab *just* the number, and hang a timestamp onto it as shown in the above example?

Regards & TIA!
Wally
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:34 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0