OT: help with text file?
Mikkel L. Ellertson
mikkel at infinity-ltd.com
Sun Jan 18 14:24:27 UTC 2009
Cameron Simpson wrote:
> On 17Jan2009 20:36, Matthew Flaschen <matthew.flaschen at gatech.edu> wrote:
> | Dave Stevens wrote:
> | > I have a sequence of lines of ASCII text of varying length, each of which ends
> | > with an integer. Anyone have a quick and dirty way of getting these lines
> | > copied to a new file with only the last number on each line of the new file?
> |
> | How about:
> | grep -o -E [[:digit:]]+$ foo.txt > new_file.txt
>
> 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?
Mikkel
--
Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20090118/ea05a978/attachment-0001.sig>
More information about the fedora-list
mailing list