OT: help with text file?

Cameron Simpson cs at zip.com.au
Sun Jan 18 03:04:17 UTC 2009


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

Cheers,
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/




More information about the fedora-list mailing list