Sponsored Content
Full Discussion: BASH ZCAT EGREP Shell Script
Top Forums Shell Programming and Scripting BASH ZCAT EGREP Shell Script Post 302720105 by metallica1973 on Tuesday 23rd of October 2012 01:12:10 PM
Old 10-23-2012
If I just:

Code:
zcat -v /var/log/syslog*
Oct 17 08:04:31 Dartanion nullmailer[1572]: Starting delivery: protocol: smtp host: mail. file: 1350367203.17107
Oct 17 08:04:31 Dartanion nullmailer[9414]: smtp: Failed: Connect failed
Oct 17 08:04:31 Dartanion nullmailer[1572]: Sending failed:  Host not found
Oct 17 08:04:31 Dartanion nullmailer[1572]: Starting delivery: protocol: smtp host: mail. file: 1350108002.10660
Oct 17 08:04:31 Dartanion nullmailer[9415]: smtp: Failed: Connect failed
Oct 17 08:04:31 Dartanion nullmailer[1572]: Sending failed:  Host not found
Oct 17 08:04:31 Dartanion nullmailer[1572]: Starting delivery: protocol: smtp host: mail. file: 1350453603.30086
Oct 17 08:04:31 Dartanion nullmailer[9416]: smtp: Failed: Connect failed
Oct 17 08:04:31 Dartanion nullmailer[1572]: Sending failed:  Host not found
Oct 17 08:04:31 Dartanion nullmailer[1572]: Starting delivery: protocol: smtp host: mail. file: 1350215920.13026
Oct 17 08:04:31 Dartanion nullmailer[9417]: smtp: Failed: Connect failed
Oct 17 08:04:31 Dartanion nullmailer[1572]: Sending failed:  Host not found
Oct 17 08:04:31 Dartanion nullmailer[1572]: Delivery complete, 8 message(s) remain.
 95.8%

I can see it going through all the files and or most of the files but I cannot seem to pass my variable into grep or egrep. ?

Last edited by Franklin52; 10-24-2012 at 03:41 AM.. Reason: fixed code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

bash shell script

im trying to teach my self bash shell scripting. i want to include command line arguments in my script i am writing for practice. when i run my script it dosnt make a difference what arguments there are, it just out puts the error message as if there were none. here is the check_opts () function in... (4 Replies)
Discussion started by: norsk hedensk
4 Replies

2. UNIX for Dummies Questions & Answers

need help with bash shell script

Hi guys! I have just started with shell programming!! I am having pronblem with variable subsitutuion. when i do egrep "*" marks this will give me the pattern match. but how can i catch the output of that result in a variable. if i say result = egrep "*" marks it gives me syntax... (2 Replies)
Discussion started by: vmtailor
2 Replies

3. Shell Programming and Scripting

Bash Shell script--need help

Hi all, i am beginner to unix and trying out a shell script which does the following. i have to calculate a persons salary. his salary is read from the keyboard. he has two types of deductions. 40% as dearness allowance and 20% as house rent. i have to print the gross salary. here is the code... (5 Replies)
Discussion started by: Irishboy24
5 Replies

4. Shell Programming and Scripting

bash: need to have egrep to return a text string if the search pattern has NOT been found

Hello all, after spending hours of searching the web I decided to create an account here. This is my first post and I hope one of the experts can help. I need to resolve a grep / sed / xargs / awk problem. My input file is just like this: ----------------------------------... (6 Replies)
Discussion started by: bash4ever
6 Replies

5. Shell Programming and Scripting

Bash shell script to check if script itself is running

hi guys we've had nagios spewing false alarm (for the umpteenth time) and finally the customer had enough so they're starting to question nagios. we had the check interval increased from 5 minutes to 2 minutes, but that's just temporary solution. I'm thinking of implementing a script on the... (8 Replies)
Discussion started by: hedkandi
8 Replies

6. Shell Programming and Scripting

Need help with bash shell script

I need to create digit day script that takes a single numeric argument and then it should print out the day of the week using the number modulo 7 formula e.g: 0 - Sunday 6- Saturday 131 - Friday I am fairly new to unix so I don't know how to use the number modulo 7 formula. Does the script need... (3 Replies)
Discussion started by: lukefrost96
3 Replies

7. Shell Programming and Scripting

Help with Bash shell script

Hi All, I have a script which as below #!/bin/bash for i in `cat servers` do ssh uname@$i "df -t xfs --total | grep total"; done > out.txtOutput as below -------------- total 140583991104 118622795524 21961195580 85% - total 140583991104 112888595524 27695395580 ... (4 Replies)
Discussion started by: npk
4 Replies

8. Shell Programming and Scripting

Different behavior between bash shell and bash script for cmd

So I'm trying to pass certain json elements as env vars and use them later on in a script. Sample json: JSON='{ "Element1": "file-123456", "Element2": "Name, of, company written in, a very weird way", "Element3": "path/to/some/file.txt", }' (part of the) script: for s... (5 Replies)
Discussion started by: da1
5 Replies

9. UNIX for Beginners Questions & Answers

In Bash shell - the ps -ef shows only the /bin/bash but the script name is not displayed

In Bash shell - the ps -ef shows only the /bin/bash but the script name is not displayed ? Is there any way to get the script names for the process command ? --- Post updated at 08:39 AM --- in KSH (Korn Shell), my command output shows the script names but when run in the Bash Shell... (3 Replies)
Discussion started by: i4ismail
3 Replies

10. UNIX for Beginners Questions & Answers

Bash shell script help

Hi everyone, first time poster so I hope you'll be gentle with me. :o I am needing some help to make a script in bash to do the following: For each file with a name beginning with the string ff_ Extract the first line of the file (the date) Change "-" to "/" in the date entry to create a... (3 Replies)
Discussion started by: pierreDefuncto
3 Replies
nullmailer-inject(1)					      General Commands Manual					      nullmailer-inject(1)

NAME
nullmailer-inject - Reformat and inject a message into the queue. SYNOPSIS
nullmailer-inject [-a] [-b] [-e] [-f sender] [-h] [recipient [recipient ...]] DESCRIPTION
This program reads a email message from standard input, reformats its header to comply with RFC822, and sends the resulting message to the queue. HEADER FIELDS The following lines are parsed for recipient addresses: To, Cc, Bcc, Apparently-To, Resent-To, Resent-Cc, and Resent-Bcc. The following sender address lines are parsed and rewritten: Sender, From, Reply-To, Return-Path, Return-Receipt-To, Errors-To, Resent- Sender, Resent-From, and Resent-Reply-To. If the Return-Path header field is present and contains a single address, its contents will be used to set the envelope sender address. If the message contains any of the following fields, it is treated as a resent message: Resent-Sender, Resent-From, Resent-Reply-To, Resent-To, Resent-Cc, Resent-Bcc, Resent-Date, Resent-Message-ID. If the message is resent, only the recipient fields prefixed with Resent- are examined for addresses. Any occurrences of Bcc, Resent-Bcc, Return-Path, or Content-Length are discarded after they are parsed (if necessary). If the header lacks a Message-Id field, a unique string is generated and added to the message. If the header lacks a Date field, the cur- rent local date and time in RFC822 format is appended to the message. If the message has no To or Cc fields, the following line is appended to the message: Cc: recipient list not shown: ; ADDRESS LISTS Address lists are expected to follow the syntax set out in RFC822. The following is a simplified explanation of the syntax. An address list is list of addresses separated by commas. An individual address may have one of the following three forms: user@fqdn, com- ment<user@fqdn>, or phrase:address-list;. Any of the first two forms may be used within the address list of the third form. Any word con- taining special characters must be placed in double quotes and the special characters must be preceded with a backslash. Comments may be placed between addresses in parenthesis. All comments are ignored. Addresses lists are reformatted as they are parsed for ease of later re-parsing when the message reaches the destination(s). If an address is missing a fqdn, nullmailer-inject adds one. OPTIONS
-a Use only the command line arguments as recipient addresses. Ignore the header recipient lines. -b Use both the command line arguments and data from the message header as recipient addresses. -e Use either the command line arguments (if there are any) or data from the message header (if there are no arguments) as the recipi- ent addresses. -f sender Set the envelope sender address to sender . -h Use only data from the message header as the recipient addresses. -n Do not queue the message, but print the reformatted contents to standard output. -v Print out the envelope (sender and recipient addresses) preceding the message when printing the message to standard output. RETURN VALUE
Exits 0 if it was successful, otherwise it prints a diagnostic message to standard output and exits 1. ENVIRONMENT
The environment variable NULLMAILER_FLAGS is parsed and the behavior of nullmailer-inject is modified if any of the following letters are present: c Use "address (comment)" style in the generated From field instead of the default "comment <address>" style. f Ignore and remove any From header lines and always insert a generated one. i Ignore and remove any Message-Id header lines. s Ignore and remove any Return-Path header lines. t Insert a To line containing a list of the recipients if the header does not contain either a To or a Cc field. If the message is determined to be a resent message (see above), a Resent-To field is added if the header does not contain either a Resent-To or a Resent-Cc field. The user name is set by NULLMAILER_USER, MAILUSER, USER, or LOGNAME, whichever comes first. If none of the above are set the name is taken from the password file, or set to unknown if that fails. The host name is set by the canonicalized value of NULLMAILER_HOST, MAILHOST, or HOSTNAME, whichever comes first, or the defaulthost config file if none of the above are set (see below). The full name of the user is set by NULLMAILER_NAME, MAILNAME, or NAME, whichever comes first. The user and host name of the envelope sender default to the user and host name set above, but may be overridden by NULLMAILER_SUSER and NULLMAILER_SHOST. If NULLMAILER_QUEUE is set, the program named is used in place of nullmailer-queue to queue the formatted message. CONTROL FILES
When reading the following files, a single line is read and stripped of all leading and trailing whitespace characters. defaultdomain The content of this file is appended to any host name that does not contain a period (except localhost), including defaulthost and idhost. Defaults to the value of the /etc/mailname system file, if it exists, otherwise the literal name defauldomain. defaulthost The content of this file is appended to any address that is missing a host name. Defaults to the value of the /etc/mailname system file, if it exists, otherwise the literal name defaulthost. idhost The content of this file is used when building the message-id string for the message. Defaults to the canonicalized value of defaulthost. /etc/mailname The fully-qualifiled host name of the computer running nullmailer. Defaults to the literal name me. SEE ALSO
nullmailer-queue(8) NOTES
This document glosses over very many details of how address parsing and rewriting actually works (among other things). nullmailer-inject(1)
All times are GMT -4. The time now is 06:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy