Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Understanding 'ongoing monitoring' Post 302520926 by jeffh on Monday 9th of May 2011 04:26:04 PM
Old 05-09-2011
OK - didn't realize I could use -f in this way!

I'm trying now to trigger an event when grep finds this line...

Code:
#! /bin/bash
if [ tail -f -n 2 /Volumes/Cache-A/TransferLog.txt | grep Total ] ; then
do more stuff
fi

However - it gives me an error saying that :
Code:
line 2: [: missing `]'

Am I allowed to use -f in this way? Or is there something else that I can do to trigger something when it sees the 'Total' in the file?

Thanks,
Jeff
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

need help understanding mv

I just started shell coding and I'm a bit confused on how 'mv' works can someone explain to me how it works and if i did this correctly. Thanks. echo "Enter Name of the first file:" read file1 #echo $file1 if ; then echo "Sorry, file does not exist." exit 1 ... (16 Replies)
Discussion started by: taiL
16 Replies

2. Shell Programming and Scripting

Help in understanding the following commands

Hi , Please help me in understanding the below commands temp="$dirname.temp.cc.$$" This will eliminate any trailing white spaces??? k=$(grep -cvE " |\+|-|0|1|\f" $temp if (substr(file,2,24) ~ /{13,}/) {print "N" file} -- this is inside an awk script (4 Replies)
Discussion started by: justchill
4 Replies

3. UNIX for Dummies Questions & Answers

understanding {%/*}/

Hi Gurus: I am trying to understand the following line of code.I did enough of googling to understand but no luck.Please help me understand the follow chunk of code: X=$0 MOD=${X%/*}/env.ksh X is the current script from which I am trying to execute. Say if X=test.ksh $MOD is echoing :... (3 Replies)
Discussion started by: vemana
3 Replies

4. UNIX for Dummies Questions & Answers

Understanding Groups

Hi cat /etc/group : .... oinstall:x:401: dba:x:400:oracle ... cat /etc/passwd|grep oracle oracle:x:130:401::/home/oracle:/bin/ksh 1. Is that mean that : ORACLE user has OINSTALL as it Primary group and DBA as secondary group ? 2. What is the linux comman to set ORACLE user with... (2 Replies)
Discussion started by: yoavbe
2 Replies

5. AIX

Help in Understanding ISMP

Hi, Good day to everyone. This is my first time joining the community and wanted to say thanks in advance for all your help and assistance. First, I am not expert in AIX and UNIX but I do know a thing or two and I have a simple question regarding ISMP. We are using AIX 5.3 and a couple... (0 Replies)
Discussion started by: lgalang
0 Replies

6. Shell Programming and Scripting

Insert ongoing numeration in each line?

Hi. I have a text file with lines like this: ( chp_testfile_0065 "Blablabla." ) ( chp_testfile_0003 "Blablabla" ) ( chp_testfile_0123 "Blablabla" ) I need one more 0 in each line, so that I have 5 digits in a sequence. I also need an ongoing numeration from 1 to n, so that (... (12 Replies)
Discussion started by: Bloomy
12 Replies

7. Shell Programming and Scripting

Need your help in understanding this

Hi, I found this in a script and I would like to know how this works Code is here: # var1=PART1_PART2 # var2=${var1##*_} # echo $var2 PART2 I'm wondering how ##* makes the Shell to understand to pick up the last value from the given. (2 Replies)
Discussion started by: sathyaonnuix
2 Replies

8. Solaris

Understanding & Monitoring CPU performance (Load vs SAR)

Hi all, Been reading a lot of the cpu load and its "analogy of it to car traffic path of expressway" From wiki Most UNIX systems count only processes in the running (on CPU) or runnable (waiting for CPU) states. However, Linux also includes processes in uninterruptible sleep states... (13 Replies)
Discussion started by: javanoob
13 Replies
ZGREP(1)						      General Commands Manual							  ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 05:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy