Sponsored Content
Full Discussion: Aix shell script question
Operating Systems AIX Aix shell script question Post 302410966 by bakunin on Wednesday 7th of April 2010 09:14:33 AM
Old 04-07-2010
Quote:
Originally Posted by elmesy
Code:
ps -ef | sed -n '/'"logger"'/{/grep/!p;}' | grep -v loggermail | awk '{print$2}' | xargs -i kill {}

I am not sure if this does what it should do:

Code:
sed -n '/logger/{/grep/!p;}'

This (takes the output of "ps -ef" and) prints all the lines containing "logger" except those which contain "grep" too. As far as i can see there is no grep process running up to this point. Probably you filtered the lines with "grep" before but switched to "sed". You should change the command accordingly to:

Code:
sed -n '/logger/{/sed/!p;}'

In this case you could also skip the next command where you filter out "loggermail", use sed for awk's task and combine this to one command, arriving at the following line:

Code:
ps -ef | sed -n '/logger[^m]/{/sed/d; s/^ *[^ ]*  *\([^ ]*\) .*$/\1/p;}' | xargs -i kill {}

I hope this helps.

bakunin
 

10 More Discussions You Might Find Interesting

1. AIX

Difference between writing Unix Shell script and AIX Shell Scripts

Hi, Please give me the detailed Differences between writing Unix Shell script and AIX Shell Scripts. Thanks in advance..... (0 Replies)
Discussion started by: haroonec
0 Replies

2. Shell Programming and Scripting

porting shell script from Linux to AIX.

Hi, I am porting one shell script from Linux to AIX. I had .ksh file and i have changed it to .sh file for aix. on linux this script is running fine but on aix it gives me "unexpected end of file" error. Could any one suggest me what to do to port this script error free? Thanks in... (6 Replies)
Discussion started by: joy_1
6 Replies

3. UNIX for Dummies Questions & Answers

Linux Shell Question: how to print the shell script name ?

Suppose I have a script named "sc.sh" in the script how to print out its name "sc.sh"? (3 Replies)
Discussion started by: meili100
3 Replies

4. AIX

AIX 4.2 Korn shell and grep question

Ho do I find out the verion of the Kron shell on my client`s system ? There is no one to ask. They are not knowledged enough (hard to believe but yes). Also, on that AIX 4.2, I am trying to figure out how to do a grep using a search patter like below but does not seam to work. The '*' do... (11 Replies)
Discussion started by: Browser_ice
11 Replies

5. Shell Programming and Scripting

shell script on AIX

Hi! I have made a simple script for writing the following line on a file (file.txt): list= 1 2 3 and thr script looks like this: N=3 ll=(1 2 3) echo -n "list= ">> file.txt j=0 while ; do echo -n ${ll}" ">> file.txt let j++ done The code works fine on Linux,... (3 Replies)
Discussion started by: carl.alv
3 Replies

6. AIX

AIX Shell script does not work

Hi. I created schell script for sending messages to some processes in AIX: #!/bin/sh BSE=/infor/ERPLN/bse BSE_TMP=/infor/ERPLN/bse/tmp export BSE BSE_TMP for i in `ps -eo pid,comm | grep bshell | cut -f 1 -d " "` do /something $i done Unfortunatelly this script does not work on... (6 Replies)
Discussion started by: giovanni
6 Replies

7. UNIX for Dummies Questions & Answers

Shell Script in AIX

Hi , Good Morning every one !!! I am very new to this forum and new to Shell Script as well , hope some script Guru's will help me . I have a requirment to write a shell script . The requirment is like this . There are couple of shell scripts scheduled in the Crontab (some scripts run... (5 Replies)
Discussion started by: dilipd21
5 Replies

8. Shell Programming and Scripting

Need help in shell script on AIX

Hi All, I am connecting from ServerA(Unix) to ServerB (AIX). Copying a Database dump file from A to B. On B i need to import that dump file. I have used the following code to do this operation but ended up with error Pseudo-terminal will not be allocated because stdin is not a terminal.... (2 Replies)
Discussion started by: maddyd2k
2 Replies

9. Shell Programming and Scripting

Want to Schedule Shell Script on AIX

Hi All, I want to schedule a shell script on AIX. But Crontab is not working in my AIX Server.Is there any alternative? Please Suggest.. (2 Replies)
Discussion started by: bharat1211
2 Replies

10. UNIX for Beginners Questions & Answers

Shell script in AIX

Hello Experts My SAP application is running in IBM AIX. Everyday my application generate some files in the below path as below. root@sedcaspm0502: pwd /interfaces/RFTS/B11/archive root@sedcaspm0502: ls -lrt -rw-r r 1 ppgadm sapsys 1039445 May 08 01:20... (1 Reply)
Discussion started by: sundar.c79@gmai
1 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:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy