Systems Automation
A Blog of Automation and Administration Activities
Saturday, May 08, 2010
Perl: Reading Processes from Unix
Here is a way using pipes
open(PS_F, "ps -f|");
while (
) {
($uid,$pid,$ppid,$restOfLine) = split;
# do whatever I want with the variables here ...
}
close(PS_F);
You can also try with split(/\s+/,$_)
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment