Record split.

I want to keep only records contain length is 10 other records should remove from my original file without redirecting to other output file.

Source
1234567890
123456789011234
abcdefghil

Expected Result
1234567890
abcdefghil

awk -F "" 'NF==10' infile

Sorry. It is not working. Can I get without awk.

Try:

 perl -ni -e 'print unless length($_)!=11;' file

Not Suppoting ... Getting error msg.

syntax error at -e line 1, near "!=="

awk 'length($0)==10' file

Hi Cabrao,

Your output giving first 10 characters in all the line.

Sorry Jairaj, I didn't read your question properly. My previous answer was updated.

Can you provide otherthan awk command.

while read; do
    ((${#REPLY}<=10)) && echo "$REPLY"
done <file