[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: OT: help with text file?



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


[13/Dec/2008:12:02:48 -0500] 216.99.54.193 SSLv3 DHE-RSA-AES256-SHA "GET /ms_tmp/4943eab7_1228_1a.jpg HTTP/1.1" 588
[13/Dec/2008:12:02:48 -0500] 216.99.54.193 SSLv3 DHE-RSA-AES256-SHA "GET /ms_tmp/4943eab7_1228_1b.jpg HTTP/1.1" 586
[13/Dec/2008:12:02:47 -0500] 216.99.54.193 SSLv3 DHE-RSA-AES256-SHA "GET /ms_tmp/4943eab6_1228_1.jpg HTTP/1.1" 162202
[13/Dec/2008:12:02:48 -0500] 216.99.54.193 SSLv3 DHE-RSA-AES256-SHA "GET /ms_tmp/4943eab7_1228_1c.jpg HTTP/1.1" 586
[13/Dec/2008:12:02:48 -0500] 216.99.54.193 SSLv3 DHE-RSA-AES256-SHA "GET /ms_tmp/4943eab7_1228_1d.jpg HTTP/1.1" 586
[13/Dec/2008:12:02:48 -0500] 216.99.54.193 SSLv3 DHE-RSA-AES256-SHA "GET /ms_tmp/4943eab7_1228_1e.jpg HTTP/1.1" 708
[13/Dec/2008:12:02:48 -0500] 216.99.54.193 SSLv3 DHE-RSA-AES256-SHA "GET /ms_tmp/4943eab7_1228_1f.jpg HTTP/1.1" 763
[13/Dec/2008:12:02:48 -0500] 216.99.54.193 SSLv3 DHE-RSA-AES256-SHA "GET /ms_tmp/4943eab7_1228_20.jpg HTTP/1.1" 699
[13/Dec/2008:12:02:48 -0500] 216.99.54.193 SSLv3 DHE-RSA-AES256-SHA "GET /ms_tmp/4943eab7_1228_21.jpg HTTP/1.1" 688
[13/Dec/2008:12:02:48 -0500] 216.99.54.193 SSLv3 DHE-RSA-AES256-SHA "GET /ms_tmp/4943eab7_1228_22.jpg HTTP/1.1" 736
[13/Dec/2008:12:02:48 -0500] 216.99.54.193 SSLv3 DHE-RSA-AES256-SHA "GET /ms_tmp/4943eab7_1228_23.jpg HTTP/1.1" 677
[13/Dec/2008:12:02:48 -0500] 216.99.54.193 SSLv3 DHE-RSA-AES256-SHA "GET /ms_tmp/4943eab7_1228_24.jpg HTTP/1.1" 699
[13/Dec/2008:12:02:48 -0500] 216.99.54.193 SSLv3 DHE-RSA-AES256-SHA "GET /ms_tmp/4943eab7_1228_25.jpg HTTP/1.1" 582
[13/Dec/2008:12:02:48 -0500] 216.99.54.193 SSLv3 DHE-RSA-AES256-SHA "GET /ms_tmp/4943eab7_1228_26.jpg HTTP/1.1" 734
[13/Dec/2008:12:02:48 -0500] 216.99.54.193 SSLv3 DHE-RSA-AES256-SHA "GET /ms_tmp/4943eab7_1228_27.jpg HTTP/1.1" 708
[13/Dec/2008:12:02:48 -0500] 216.99.54.193 SSLv3 DHE-RSA-AES256-SHA "GET /ms_tmp/4943eab7_1228_28.jpg HTTP/1.1" 709
[13/Dec/2008:12:02:48 -0500] 216.99.54.193 SSLv3 DHE-RSA-AES256-SHA "GET /ms_tmp/4943eab7_1228_29.jpg HTTP/1.1" 733
[13/Dec/2008:12:02:48 -0500] 216.99.54.193 SSLv3 DHE-RSA-AES256-SHA "GET /ms_tmp/4943eab7_1228_2a.jpg HTTP/1.1" 714
[13/Dec/2008:12:02:48 -0500] 216.99.54.193 SSLv3 DHE-RSA-AES256-SHA "GET /ms_tmp/4943eab7_1228_2b.jpg HTTP/1.1" 748
[13/Dec/2008:12:02:51 -0500] 216.99.54.193 SSLv3 DHE-RSA-AES256-SHA "POST /mapchat/portal/getData.php HTTP/1.1" 451
[13/Dec/2008:12:02:57 -0500] 216.99.54.193 SSLv3 DHE-RSA-AES256-SHA "POST /mapchat/portal/getData.php HTTP/1.1" 451
588
586
162202
586
586
708
763
699
688
736
677
699
582
734
708
709
733
714
748
451
451

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]