Re: OT: help with text file?

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

 



On Sunday 18 January 2009 08:38:09 am Matthew Flaschen wrote:
> Mikkel L. Ellertson wrote:
> >> I see your grep and raise you a sed:
> >>
> >>   sed 's/.*[^0-9]//' foo.txt >new_file.txt
> >
> > What happens if there is a number in the middle of the line of text,
> > as well as at the end? Wouldn't that give you more text then desired?
>
> 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:

[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

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.

Thanks to all,

dave

-- 
Canada must refuse to be entangled in any more wars fought to make the world 
safe for capitalism.

-- The Regina Manifesto, 1933

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux