Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: extracting value in a string after checking value after colon ':'

by shadowsong (Pilgrim)
on Jan 31, 2019 at 00:13 UTC ( [id://1229181]=note: print w/replies, xml ) Need Help??


in reply to extracting value in a string after checking value after colon ':'

Hi t-rex

While there’s not much more value to be added beyond Athanasius’ response; (assuming your data resides in "file.txt") here's the obligatory one-liner:

perl -lwne "print $1 if /(\d+)\s+cpus:\s*$/" file.txt

Best of luck
Shadowsong

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2024-03-28 14:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found