SPUG: Checking for ASCII files
James Moore
james at banshee.com
Tue May 15 14:38:38 CDT 2001
Most UNIX flavors today already have a utility that will convert
MSDOS-format files to UNIX. See if your system has dos2unix. (Not that
I want to discourage using perl, but don't reinvent the wheel if you
don't have to.)
Something like:
find /where/you/put/files -exec file {} \; | grep text | sed -e
"s/:.*//" | xargs dos2unix
may solve your problem without needing to write code.
James Moore
james at banshee.com
Lorraine Johnson wrote:
> Hello,
>
> 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?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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