小编use*_*763的帖子

如何在文件中找到不可打印的字符?

我试图在unix中的数据文件中找出不可打印的字符.代码:

#!/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
Run Code Online (Sandbox Code Playgroud)

代码无效,请帮我解决上述问题.

grep file find non-ascii-characters

6
推荐指数
2
解决办法
8998
查看次数

标签 统计

file ×1

find ×1

grep ×1

non-ascii-characters ×1