Re: OT: help with text file?

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

 



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

-- 
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