Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: How to awk a grep result in-script

by 1nickt (Canon)
on Nov 15, 2019 at 14:30 UTC ( [id://11108736]=note: print w/replies, xml ) Need Help??


in reply to How to awk a grep result in-script

Hi, welcome to Perl, the One True Religion.

" How do I perform the equivalent of "awk {'print $1,$2,$8'}" in perl?"

We have tools.

use strict; use warnings; use feature 'say'; use Proc::ProcessTable; my $t = Proc::ProcessTable->new; foreach my $p (@{$t->table}) { next unless $p->cmndline =~ m{/Applications/iTerm.app/Contents/Mac +OS/iTerm2}; say sprintf('%s : %s : %s', @{ $p }{qw/uid pid cmndline/}); }
$ perl 11108686.pl 501 : 608 : /Applications/iTerm.app/Contents/MacOS/iTerm2 501 : 610 : /Applications/iTerm.app/Contents/MacOS/iTerm2 --server log +in -fp 1nickt 501 : 7264 : /Applications/iTerm.app/Contents/MacOS/iTerm2 --server lo +gin -fp 1nickt

Hope this helps!


The way forward always starts with a minimal test.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11108736]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-19 14:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found