how to grep certain pattern

-Hi
I have a file with the following entries:

tschkback12
tschkback11
tschkback15
tschkback28
....etc.

I need to grep all the lines out of this file which end with the number (just "tschkback" should be excluded). Can it be done with one line command? Thanks -A

Yes it can.

$
$ cat input.txt
tschkback12
tschkback28
tschkback
tschkback9
tschkback
tschkback123
$
$ perl -ne 'print if /\d$/' input.txt
tschkback12
tschkback28
tschkback9
tschkback123
$
$ awk '/[0-9]$/ {print}' input.txt
tschkback12
tschkback28
tschkback9
tschkback123
$
$

tyler_durden

Thanks a lot

sed -n '/[0-9]$/s/.*[^0-9]\(.*\)/\1/p' myFile

P.S. never mind - misinterpreted the requirement.

Try this

sed  -n '/^.*[0-9]*[0-9]$/{s/^[^[:digit:]]*\([0-9][0-9]*\)$/\1/g;p}' file

cheers,
Devaraj Takhellambam

If you are specifically looking for something from the grep family of commands, then I guess you could use egrep thusly:

$
$ egrep '[0-9]$' input.txt
tschkback12
tschkback28
tschkback9
tschkback123
$
$

tyler_durden