Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: How do i extract 3 variables from each line in a file, and print them to a new file

by monarch (Priest)
on Jul 08, 2005 at 16:14 UTC ( #473467=note: print w/replies, xml ) Need Help??


in reply to How do i extract 3 variables from each line in a file, and print them to a new file

If you just want the last 3 numbers in a line you can use a regular expression:
my $line = "3434 34456... 321ms:543ms:45ms"; if ( $line =~ m/(\d+)\D+(\d+)\D+(\d+)\D+$/ ) { print( "$1,$2,$3\n" ); }
  • Comment on Re: How do i extract 3 variables from each line in a file, and print them to a new file
  • Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2020-05-25 14:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (146 votes). Check out past polls.

    Notices?