Need help in a line formatting

i have a script that check for a file called TNS.txt.I need little help in formatting

TNS.txt

0001804026

what i want is whenever there is space after the digit it should be rejected or should not be taken into account.

TNS.txt with space:

0001804026[space]

wc -c 
11

The below command is not working:The result should be 10

0001804026[space]

cat TNS.txt | grep -v "^$" | wc -c
11

How to ignore spaces in the same line ?

This might help you

$ echo "0001804026" | awk -F "" '{print NF}'

Hope this helps:

sed "/  *$/d" TNS.txt

jaduks and angheloko, the OP wants to get rid of the trailing space. One way, assuming you have only 1 column in your file:

awk '{print $1}' file > newfile

Regards

Oh, my bad. I misinterpreted because of this line. I though that the "whole" line should be ignored. Sorry man :stuck_out_tongue: