Sponsored Content
Top Forums UNIX for Dummies Questions & Answers passing grepped date var into code Post 302709355 by bdby on Wednesday 3rd of October 2012 07:20:46 AM
Old 10-03-2012
Good Morning,

Thank you for the quick response. All this bash scripting is new to me so I will go over in great detail what was just written to understand this code. I need to get this stuff in my head and the only way to do it for me is just to "do it". I appreciate you being a mentor.

I will let you know how it runs.

regards,

al

---------- Post updated at 07:20 AM ---------- Previous update was at 06:52 AM ----------

Good Morning,

I am reading the code over and I did some research on the portion | grep -v grep|. The formula is grep pattern filename1 filename2.

I can't seem to understand why this is done nor where the -v is coming from.

A brief explanation would be appreciated.

thanks

al
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing Date as parameter with sh script

Hi I need to pass a date argument with my shell script. Can any one send me code for the same. eg For 15th Aug 2006. Iwant to pass parameter like this ./startenv.sh 08/15/2006. Everyday date argument must change. Will the below code work ? ./startenv.sh date '+%m/%d/%y' THanks... (1 Reply)
Discussion started by: pankajkrmishra
1 Replies

2. Shell Programming and Scripting

passing date parameter in cronjob

Hi All, I have a crontab entry for every 5 min running. 5 * * * * /tmp/scripts/ksh/CsVues_H.sh `date +%Y%m%d_%H` >> /tmp/scripts/ksh/Cronresult.log and I am passing the date parameter. ( `date +%Y%m%d_%H` ) But the parameter values which i am expecting inside the script is... (6 Replies)
Discussion started by: scorpio
6 Replies

3. Shell Programming and Scripting

Unix Script to email grepped results

I am following the tread number 81556 to grep a file and send the results in email. #/bin/bash /bin/grep -i 'invite sip' /var/log/asterisk/full if echo "found" | mail -s 'invite sip' mail@gmail.com When I just build it to grep and mail, it works fine. However, the if statement causes... (4 Replies)
Discussion started by: klysdale
4 Replies

4. Solaris

SFTP passing variables date

Hi, Anyone can help me on how to solve my problem not getting the actual $DATE saying . Here my scripts; #!/bin/sh DATE='20110331' sftp -oUserKnownHostsFile=/.ssh/known_hosts -oIdentityFile=/.ssh/id_rsa -b /source/transfer.sh server1@sftp.com <<EOF #tranfer.sh put... (3 Replies)
Discussion started by: fspalero
3 Replies

5. Shell Programming and Scripting

Passing CURL a date argument (formatting)

Im trying to pass curl a list of arguments... one of which is a date... When I run from the command line it works fine but when i try to run the same from a script passing variables it reformats the date for some reason and doesn't work. Example: curlstring=xxxxxxxxxxx.xxx.xxx:8090/csv/... (1 Reply)
Discussion started by: atelford
1 Replies

6. Shell Programming and Scripting

Replacing grepped text.

Dear Friends, I need your help once again. I have a flat file from which I have grepped something and kept in a separate file for some reason. I want to replace these grepped srtings with the strings in another file. E.g. Actual_file.txt COLOR: 33179 Lakme SEPT2011 Lot No: BR25324 ... (5 Replies)
Discussion started by: anushree.a
5 Replies

7. Shell Programming and Scripting

Passing date into awk...

Hi All.... I need to pass date into awk and parse logfile based on that.... i used both awk and /usr/xpg4/bin/awk... both are throwing up error..... So here is the stuff... when i use /usr/xpg4/bin/awk : DATE=`date '+%Y %b %d'` START=00 END=23 /usr/xpg4/bin/awk -v DATE={"$DATE"} -v... (3 Replies)
Discussion started by: Nithz
3 Replies

8. Shell Programming and Scripting

How to get a number from a grepped sentence of a file?

I want get a number(ID) from a sentence which has been grepped from file using error number. For Example: #!/bin/ksh echo "Enter RRS ID: " read rrs echo "Enter error number:" read err scp -pr ptc-avdbamdw102:/home/icsprd/M3logs/Accurate/logs/corp_post/$rrs.*.err.txt $HOME/daemon_mail/... (7 Replies)
Discussion started by: JayDoshi
7 Replies

9. Shell Programming and Scripting

Passing PERL var values to SH Shell Script

Greetings all, If I have a SH script that calls a PERL script in the following way: perl $HOME/scripts/config.properties And in the config.properties PERL file, this Perl script only sets a number of environmental parameters in the following way: #!/usr/bin/perl $VAR1 = ( ... (3 Replies)
Discussion started by: gikyo12
3 Replies

10. UNIX for Dummies Questions & Answers

Print the grepped string alongwith the filename

We have C shell and we are executing the below script: #!/bin/csh -f if ($#argv != 2) then echo "Usage $0 DirecotryPath Inputfilename" exit 1 endif set dir=$1 set fname=$2 echo $dir foreach line ( `cat $fname` ) echo \ ======================================== >>... (2 Replies)
Discussion started by: donisback
2 Replies
escape(1)							Mail Avenger 0.8.3							 escape(1)

NAME
escape - escape shell special characters in a string SYNOPSIS
escape string DESCRIPTION
escape prepends a "" character to all shell special characters in string, making it safe to compose a shell command with the result. EXAMPLES
The following is a contrived example showing how one can unintentionally end up executing the contents of a string: $ var='; echo gotcha!' $ eval echo hi $var hi gotcha! $ Using escape, one can avoid executing the contents of $var: $ eval echo hi `escape "$var"` hi ; echo gotcha! $ A less contrived example is passing arguments to Mail Avenger bodytest commands containing possibly unsafe environment variables. For example, you might write a hypothetical reject_bcc script to reject mail not explicitly addressed to the recipient: #!/bin/sh formail -x to -x cc -x resent-to -x resent-cc | fgrep "$1" > /dev/null && exit 0 echo "<$1>.. address does not accept blind carbon copies" exit 100 To invoke this script, passing it the recipient address as an argument, you would need to put the following in your Mail Avenger rcpt script: bodytest reject_bcc `escape "$RECIPIENT"` SEE ALSO
avenger(1), The Mail Avenger home page: <http://www.mailavenger.org/>. BUGS
escape is designed for the Bourne shell, which is what Mail Avenger scripts use. escape might or might not work with other shells. AUTHOR
David Mazieres Mail Avenger 0.8.3 2012-04-05 escape(1)
All times are GMT -4. The time now is 07:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy