That picks up numbers at the end of the line. If you want the last number in the line (ignoring possible trailing text) throw in \D* before the $.perl -ne 'if (/(\d+(\.\d+)?)$/) {print $1, "\n"}' file1 file2
In reply to RE (tilly) 3: Why regular expression so hard?!
by tilly
in thread Why regular expression so hard?!
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |