in reply to Re^2: Perl doesn't read whole file
in thread Perl doesn't read whole file
perl -n00 -e 'print $1,"\n" if /Overall Grade.*?([\d.]+%)/ms' history. +txt
That should produce
95.9%
i.e. the contents of line 32.
See perlrun for command line switches, perlre for regular expressions.
<update>
Using a regular expression here is more reliable, since the line number where the sought information is stored arguably is more prone to changes than the format of the retrieved file.
</update>
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Perl doesn't read whole file
by colonelcrayon (Novice) on Dec 03, 2007 at 00:17 UTC |