English 中文(简体)
非阿西语搜索文件
原标题:search document for non-ascii

我的计算机应用需要读到文字档案中。 我有几次工作,有一次没有工作;该方案没有读到,告诉我,有些地方有坏。 我的第一gues是,有些地方具有非敌对性,但我不知道如何找到。 Per或任何普通reg都是冰。 任何想法?

最佳回答

您可使用<代码>[^x20-x7E],与非ASCII特性相匹配。

e.g. grep -P [^x20-x7E] suspicious_file

问题回答
perl -wne  printf "byte %02X in line $.
", ord $& while s/[^	
x20-x7E]//; 

将发现并非ASCII营养特性、表、空间或新线的特性。

If it reports 0Ds (carriage-returns) in files that are O.K., then change to .

如果在坏的档案中只报告0D,那么你可能通过操作dos2unix将这些文件固定下来。

如果你在源代码中使用推器,则尝试这种模式:

[^x08-x7E]

Works also in Notepad++





相关问题
Why does my chdir to a filehandle not work in Perl?

When I try a "chdir" with a filehandle as argument, "chdir" returns 0 and a pwd returns still the same directory. Should that be so? I tried this, because in the documentation to chdir I found: "...

How do I use GetOptions to get the default argument?

I ve read the doc for GetOptions but I can t seem to find what I need... (maybe I am blind) What I want to do is to parse command line like this myperlscript.pl -mode [sth] [inputfile] I can use ...

Object-Oriented Perl constructor syntax and named parameters

I m a little confused about what is going on in Perl constructors. I found these two examples perldoc perlbot. package Foo; #In Perl, the constructor is just a subroutine called new. sub new { #I ...

Where can I find object-oriented Perl tutorials? [closed]

A Google search yields a number of results - but which ones are the best? The Perl site appears to contain two - perlboot and perltoot. I m reading these now, but what else is out there? Note: I ve ...

热门标签