OT: help with text file?
Matthew Flaschen
matthew.flaschen at gatech.edu
Sun Jan 18 16:38:09 UTC 2009
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
More information about the fedora-list
mailing list