Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Format file2

by wfsp (Abbot)
on Jan 25, 2011 at 09:03 UTC ( [id://884079]=note: print w/replies, xml ) Need Help??


in reply to Format file2

"I wish to pick certain pieces of information from each line..."
You need to show us what a line looks like.

Replies are listed 'Best First'.
Re^2: Format file2
by velocitymodel (Acolyte) on Jan 25, 2011 at 23:50 UTC

    My file is on another computer and this file contains over 17000 seismic events recorded from stations. This is what an event would look like in my file.

    The first line is year, month, day, the origin of the quake in hrs, min., sec., the lat., long, depth, magnitude at 3 different places, the no of stations recording the event, the azimuthal gap, dmin, rms, erh, erz, quality, source, other mags, location/ comments. This would look like this in the file;  10 11 01 1127 47.7 44.798 111.367 9.4 .8 2.2 0.0 19 91 0.10 0.4 0.5 b MBMG 0.0 0.0 0.0 7.7 km SSW of Hebgen Dam

    that would be the first line. The other lines contain the actual event data. I want to pick pieces of data from each of these columns of data and sort it into a format for a new file to be run through another program. I don't know how to declare variables when the information is in columns. How do I call the value for the number of stations from that line of code.

      split the line on whitespace and store the results in an array. If the number of stations is the 5th token on the line, access it like this:
      my @tokens = split; my $num_st = $tokens[4];

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (2)
As of 2024-04-26 05:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found