![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| comparing values of same variable | coolkid | Shell Programming and Scripting | 2 | 05-27-2008 06:45 PM |
| Problem cutting & comparing values | wilsontan | Shell Programming and Scripting | 6 | 02-09-2006 11:48 AM |
| comparing two decimal values in KSH | nandinisagar | Shell Programming and Scripting | 4 | 11-15-2005 06:36 PM |
| shell script comparing files in a file | raina_nalin | Shell Programming and Scripting | 4 | 06-21-2005 07:00 AM |
| comparing two float values | kavitha | Shell Programming and Scripting | 2 | 04-03-2004 02:32 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
comparing PID values of 2 Files in shell Options
Hi,
There is a file having a list of running PIDs and another file having a list of registered PIDs. How can we check if each value of running PIDs are less or more than the registered PIDs i.e. comparing the value of each PID in both the files. Request you to pls give your inputs. Thanks a lot in advance. |
|
||||
|
This doesn't make a lot of sense to me. PID's change as processes create new children, end, etc. try awk: Code:
awk '
if FILENAME=="regfile" {i++; arr[i]=$1}
if FILENAME=="pidfile" { if (arr[$NR] > $1 { print $1, " is greater than ", arr[$NR]}
if (arr[$NR] > $1 { print $1, " is less than ", arr[$NR]}
if (arr[$NR] = $1 { print $1, " is equal to ", arr[$NR]}
} ' regfile pidfile
|
|
||||
|
Apart from equality, what do less and more tell you about pids? It tells me more about the scripter than anything truely useful about the pids.
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|