Search only numbers in a file

Hello team,

Suppose I have a file named that has following content:

abc123
1897
msxi12
------------
########
((((( rapjagc )))))))
34229
xxxxxxxxxxxx
@@@536

I need those lines that contain only numbers from this file.
means -- it should eliminate alphanumber, special characters and characters.

like from above example I need these lines:

1897
34229 

Please help me on this

grep -xE '[0-9]+' infile

Use the POSIX grep (/usr/xpg4/bin/grep) if you're on Solaris.

Through sed..

sed '/^[0-9][0-9]*$/!d' inputfile > outfile
egrep ^[0-9]+$ infile