Monday, 26 December 2016

grep - How to find non-printable characters in the file?

I tried to find out the unprintable characters in data filein unix.
Code :



#!/bin/ksh

export SRCFILE='/data/temp1.dat'
while read line
do
len=lenght($line)
for( $i = 0; $i < $len; $i++ ) {

if( ord(substr($line, $i, 1)) > 127 )
{
print "$line\n";
last;

}
done < $SRCFILE


The code is not working , please help me in getting a solution for the above query.

No comments:

Post a Comment