Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

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

by shadowsong (Pilgrim)
on Jan 31, 2019 at 00:13 UTC ( #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

  • Comment on Re: extracting value in a string after checking value after colon ':'
  • Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2019-07-22 22:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If you were the first to set foot on the Moon, what would be your epigram?






    Results (21 votes). Check out past polls.

    Notices?