Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: How to parse this file

by roboticus (Chancellor)
on Oct 19, 2011 at 14:53 UTC ( #932427=note: print w/replies, xml ) Need Help??

in reply to How to parse this file


I'd do it something[1] like this:

my @cols_to_keep = (0, 2, 3, 5, 6, 8 .. 18); while (my $line = readline(ARGV)) { my @fields = split /\s+/, $line; print FILE2 join(" ", @fields[@cols_to_keep]), "\n"; }

[1] i.e., untested, etc.


When your only tool is a hammer, all problems look like your thumb.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://932427]
[james28909]: yep, i am scraping a websites date/time stamp from an article. none of that is relevant though because the strings i get are as expected. the returned data from the website is the list of @weekdays
[james28909]: i need to convert those @weekdays to an numerical date based off of scalar localtime
[james28909]: i have thught about this and though about it lol

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2017-04-29 03:47 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (531 votes). Check out past polls.