Sponsored Content
Top Forums Shell Programming and Scripting Using grep command to detect presence of script run Post 302895663 by DGPickett on Tuesday 1st of April 2014 03:51:35 PM
Old 04-01-2014
Case sensitivity is OK, so 'grep -c' not grep -ic'. The meta characters '[]' escaping the '.' keep it from being counted. LINUX users have 'pgrep -c sfs_load_file.ksh'

Still misses sourced runs, or someone running it through a link or sym-link. The fuser tactic is slower, but gets everyone on the inode. That just leaves people running it through a copy of a different name.
This User Gave Thanks to DGPickett For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

can anyone help with shell script command about searching word with grep command?

i want to search in the current directory all the files that contain one word for example "hello" i want to achieve it with the grep command but not with the grep * (2 Replies)
Discussion started by: aintour
2 Replies

2. OS X (Apple)

command to check presence of volume

Hi: I'm not really a programmer, but I've created a small logout hook script to copy some specific directories to a server volume when a user logs out (10.6.4). These is a laptop user, so I'm looking find: 1) the command to check if the volume (including path to directory?) is available. ... (1 Reply)
Discussion started by: kevinmmac
1 Replies

3. Shell Programming and Scripting

Need help! command working ok when executed in command line, but fails when run inside a script!

Hi everyone, when executing this command in unix: echo "WM7 Fatal Alerts:", $(cat query1.txt) > a.csvIt works fine, but running this command in a shell script gives an error saying that there's a syntax error. here is content of my script: tdbsrvr$ vi hc.sh "hc.sh" 22 lines, 509... (4 Replies)
Discussion started by: 4dirk1
4 Replies

4. Shell Programming and Scripting

script will not run cp command

Hi, Not sure what the issue is here, but when i run the script. A simple copy command, it does not find the cp command ? See scrpt below : #!/bin/sh set -x ############################################# # Backup Processes #... (4 Replies)
Discussion started by: venhart
4 Replies

5. Shell Programming and Scripting

Script for telnet and run one command kill it and run another command using while loop

( sleep 3 echo ${LOGIN} sleep 2 echo ${PSWD} sleep 2 while read line do echo "$line" PID=$? sleep 2 kill -9 $PID done < temp sleep 5 echo "exit" ) | telnet ${HOST} while is executing only command and exits. (5 Replies)
Discussion started by: sooda
5 Replies

6. Shell Programming and Scripting

Script to run command one by one

Hi, I have run a lot of commands one after one, but I can't run them simultaneous. One command has to run and when finished second command has to run etc. Also I would like to save all the outputs created by the commands in a file. The commands can sometimes take hours, so it is also... (10 Replies)
Discussion started by: misterx12345
10 Replies

7. Shell Programming and Scripting

Run script like command

hello i have write a script which can create username + password #!/bin/bash # Script to add a user to Linux system if ; then read -p "Enter username : " username read -s -p "Enter password : " password egrep "^$username" /etc/passwd >/dev/null if ; then... (3 Replies)
Discussion started by: nimafire
3 Replies

8. Shell Programming and Scripting

Substitute grep command at run time

HI I am trying to use the following code in the shell script (using grep) usage() { echo "Usage: ./$0 <file name> <interval> <pattern>" } METRICS_FILE=$1 INTERVAL=$2 PATTERN="$3" .. if then PATTERN="grep Gx" fi COUNT=`cat ${METRICS_FILE} | "${PATTERN}" |egrep... (8 Replies)
Discussion started by: asifansari
8 Replies

9. Ubuntu

Detect and run command upon mouse movement

I am trying to find a way to run a command upon any movement of a mouse. The 1st statement shows the mouse co-ordinates. So it can detect mouse movement. xinput test 9 First list input devices: $ xinput list If possible, I would like to use it in a bash script. (2 Replies)
Discussion started by: drew77
2 Replies

10. UNIX for Beginners Questions & Answers

How to detect which process is run by what?

Hello, I am running under ubuntu 14.04 Very long time ago, I set a script (ban.sh) to block ip addresses abusing my system which was not active. I have not touched the server over six months or more. Today, after restart the system, ban.sh started running all of a sudden and keep submitting... (4 Replies)
Discussion started by: baris35
4 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 03:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy