How to remove lines containing strings

Hi Guys,

I need some script in removing lines containing strings like ",, ," and "rows". Retain only numbers as the output. See below for the input and output file.

INPUT FILE:

9817
9832
6285
6312
6313
6318
,,  ,
6329
7078
7098
7130
7959
7983
1253
1254
1257
,,  ,
,rows,selected
,,  ,

DESIRED OUTPUT FILE:

9817
9832
6285
6312
6313
6318
6329
7078
7098
7130
7959
7983
1253
1254
1257

Thanks in advance.

Br,
Pinpe

sed '/,,  ,/d;/rows/d' infile > outfile
awk 'int($1)' file > newfile

one more option with "SED"

sed -n '/^[0-9]/p' <file_name>
% grep -v "," input_file
$ grep "^[0-9]\{4\}$" inputfile
9817
9832
6285
6312
6313
6318
6329
7078
7098
7130
7959
7983
1253
1254
1257

It will leave empty lines behind.

However the humble grep is a strong contender.

grep '[[:digit:]]' input_file

or little more specific

grep -E '^[[:digit:]]+$' input_file

awk

awk '!/,/'  inputfile