SPUG: Checking for ASCII files
Colin Meyer
cmeyer at helvella.org
Tue May 15 14:38:23 CDT 2001
Lorraine,
On Tue, May 15, 2001 at 11:46:12AM -0700, Lorraine Johnson wrote:
> Hello,
>
> I'm sure this is an old question, but I'm obviously looking in the wrong
> place for the answer.... We develop under Windows then copy source to an
> HP-UX box to build. (Long story.) We're writing a Unix Perl script to
> navigate the directories and convert the Windows newlines to Unix newlines.
> We know all the pieces but one: What is the best way to determine if a file
> is ASCII or non-ASCII?
perl -e 'print $_, -T $_ ? " is" : " is not", " a text file\n" for (@ARGV)'
The operative is the -T file test. See 'perldoc -f -T' for more info.
-C.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
More information about the spug-list
mailing list