OT: help with text file?
Matthew Flaschen
matthew.flaschen at gatech.edu
Mon Jan 19 00:28:44 UTC 2009
Dave Stevens wrote:
>> No, because .* is greedy. The .* will consume all but the very last
>> non-numeric character (including numeric chars before the last
>> non-numeric), then [^0-9] will consume the last non-numeric char.
>>
>> Matt Flaschen
>
> ok, ok I give up! I can now see I ought to have posted a data sample,
> herewith:
Yes, you should have, but...
> so this is a SSL logfile, I only wanted the number at the end of the line. AWK
> was the first post that did it, all the others produced empty output files.
> I've got it now.
My command:
grep -oE [0-9]+$ foo.txt>new_file.txt
works exactly as I would expect on my system (provided there's no
perversely named 3+$ file in the current directory; if there is, quote
the regex). It produces the same result as the awk. Input and output
attached.
Matt Flaschen
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: foo.txt
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20090118/8168b4b0/attachment-0002.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: new_file.txt
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20090118/8168b4b0/attachment-0003.txt>
More information about the fedora-list
mailing list