06-12-2008
Iteration through the results from a unix command
Hi,
I am using a command "ps -ef | grep identify" which results more than 1 results. Actually I need to get the time from each of them , compare with the current date and conditionally stop a process.
The problem I am facing is to iterate through the results getting from the command. Please Help me regarding this script.
Plz let me know if my problem is not clear....
Thanks
Devi
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
Hi, I run the command:
hostname to get the host back from the server: db201
Now, I need to take that result and set it to a variable. Can anyone help me with this?? I need to be able to use the same script on multiple servers so I do not want to hardcode the hostname result into... (1 Reply)
Discussion started by: stky13
1 Replies
2. Shell Programming and Scripting
Hello community
I'd like to join to command results and put it to the same line in one file, how can I do that?
file: a.txt
so when I put Date '+%H:%M' and echo date '+%D' in the file appears 14:44 01/05/08 not
14:44
01/05/08
I like to know how can I make a substituion of a whole... (6 Replies)
Discussion started by: ncatdesigner
6 Replies
3. Shell Programming and Scripting
Hi,
I want to use the following ps coomand:
ps -ef | grep test
Result of this command is:
Test 161220 1 0 Oct 04 - 1:11 /test/test
Just mentioning the description of each value in the result:
UID PID PPID C STIME TTY TIME CMD
Test 161220... (11 Replies)
Discussion started by: yale_work
11 Replies
4. UNIX for Dummies Questions & Answers
I recently encountered this on the AIX system
df command showed usage is 100% i.e 1.5 GB while du command showed usage is only 500MB
Why are the 2 commands showing different output
This command shows usage is 1.5 GB
nlxdsm29:deqadm 24> df -k .
/usr/sap/DEQ ... (3 Replies)
Discussion started by: ameya_joshi
3 Replies
5. Shell Programming and Scripting
works as expected
$ ssh 172.24.40.100
Last login: Mon Jan 1 06:07:24 2001 from 172.24.41.78
# /path/script.sh
gives me error consistent with env setup
$ ssh 172.24.40.100 /path/script.sh
Which implies the latter is running the script.sh on host a, when I want to 'launch' in from a, and... (3 Replies)
Discussion started by: IanVaughan
3 Replies
6. Shell Programming and Scripting
I have written the following script to update some Debian boxes.
#!/bin/bash
mxg_hosts_file="/etc/mxg/ssh-hosts"
while read line ; do
mxg_host="$(echo ${line} | awk -F":" '{print $1}')"
mxg_port="$(echo ${line} | awk -F":" '{print $2}')"
echo "Connecting and Upgrading... (3 Replies)
Discussion started by: jelloir
3 Replies
7. Shell Programming and Scripting
Sorry folks, Second time today.
I am working on a script that accepts data via pipe and processes it.
I expect it to work as:
# command | ProcScript.sh
Within ProcScript.sh, I want to be able to give the target of the prev run command
I am using history 2 | grep -v history | awk... (18 Replies)
Discussion started by: Marc G
18 Replies
8. Shell Programming and Scripting
I am trying to check multiple server's "uptime" in a loop over "ssh".
When I execute multiple ssh commands with hard coded servernames script is executing fine.
But when I pass server names using while loop, script is exiting after checking first server's status, why?
# serverList... (8 Replies)
Discussion started by: kchinnam
8 Replies
9. Shell Programming and Scripting
from the CLI on a Mac, if you type networksetup -listallnetworkservices then you get results in a multi-line paragraph that look something like this:
networksetup -listallnetworkservices
An asterisk (*) denotes that a network service is disabled.
Wi-Fi
Display Ethernet
Bluetooth DUN... (7 Replies)
Discussion started by: hungryd
7 Replies
10. Shell Programming and Scripting
Hi,
i have a file hello.log which as several line that look like the below
2015-12-07 09:46:56 0:339 120.111.12.12 POST /helloWorld
2015-12-07 09:46:57 0:439 122.111.12.12 POST /helloWorld
....
when i grep expecting to see results like the below.
... (6 Replies)
Discussion started by: mohtashims
6 Replies
LEARN ABOUT CENTOS
xmltest
xmltest(1) General Commands Manual xmltest(1)
NAME
xmltest - Test script to send CIM-XML (via wbemcat) to CIMOM and compare to known results
SYNOPSIS
xmltest [FILE]
DESCRIPTION
xmltest is a script that is used to send a raw CIM-XML test file to the sfcb CIMOM (using wbemcat) and then compares the returned CIM-XML
results against a previously determined 'OK' result file to check whether the returned results match the expected results. If there does
not yet exist an 'OK' corresponding to the XML file then xmltest will save the returned results as the new OK file for later use. If the
returned CIM-XML results don't match the existing 'OK' file a new 'result' file will be generated containing the erroneous results.
If no FILE is specified xmltest will use all files with a .xml extension in the current directory path.
EXAMPLE
If there is no 'OK' file to compare returned CIM-XML results against xmltest will generate one.
# xmltest test/getclass.Linux_OperatingSystem.xml
Running test test/getclass.Linux_OperatingSystem.xml ... OK
Saving response as test/getclass.Linux_OperatingSystem.OK
If the returned CIM-XML results match the existing 'OK' file xmltest will signal that the test passed.
# xmltest test/getclass.Linux_OperatingSystem.xml
Running test test/getclass.Linux_OperatingSystem.xml ... Passed
If the returned CIM-XML results don't match the existing 'OK' file xmltest will signal that the tes failed and generate a 'result' file
containing the erroneous results.
# xmltest test/getclass.Linux_OperatingSystem.xml
Running test test/getclass.Linux_OperatingSystem.xml ... FAILED
Check test/getclass.Linux_OperatingSystem.result for errors
PREREQUISITES
Requires wbemcat on search path.
AUTHOR
Dr. Gareth S. Bestor <bestor@us.ibm.com>
CONTRIBUTORS
Adrian Schuur <schuur@de.ibm.com>
BUGS
Does not adequately deal with additional http headers/footers caused by chunking responses, which will result in false failures when com-
paring results to existing "x.OK" files.
The SBLIM project maintains a mailing list to which you should direct all questions regarding sfcb, sfcc, wbemcli, or any of the SBLIM
providers. To subscribe to this mailing list visit
http://lists.sourceforge.net/lists/listinfo/sblim-issues
The SBLIM Project Bug tracking page can be found at
http://sourceforge.net/tracker/?group_id=128809&atid=712784
COPYRIGHT
(C) Copyright IBM Corp. 2004, 2005
AVAILABILITY
The Small-Footprint CIM Broker (sfcb) is a part of the SBLIM project. The most recent version is available on the web at
http://sblim.sourceforge.net/
SEE ALSO
wbemcat(1)
xmltest Version 1.3.16 August 2005 xmltest(1)