[Techtalk] winmodem hsfconfig problem
Almut Behrens
almut-behrens at gmx.net
Sat Jun 12 22:56:17 EST 2004
On Sat, Jun 12, 2004 at 07:51:31PM +0200, Gebhard Dettmar wrote:
> I don't know if I have dos2unix (sitting here at work) Since this
> should be the case in every file in every subdirectory of the driver,
> could I use Devdas perl-script with find?
> find . -name *.* -exec perl -pi -e 's/\r\n/\n/' {} \;
Exactly. Well, almost ;) A few minor issues to consider:
(1) *.* (under unix) only matches files with a dot in their name. If
there are any other ascii/text files you also want to have the line
ending conversion be applied to, try a simple "*" instead.
(2) Adding a "-type f" to the find command would get rid of unnecessary
error messages, if there are subdirectories (with a "." in their name).
(3) Be careful if there are any non-text files in your tree. Perl
would do the \r\n -> \n substitution in binaries as well, and thus
typically render them unusable. (This is probably irrelevant, if it's
a source-only tree -- just pointing out a potential pitfall...)
Something like this
find . -name "*" -exec file {} \; | grep " text" | cut -d: -f1 | xargs perl -pi -e 's/\r\n/\n/'
would probably do a better job in this case -- though it's still got
its problems (e.g. there may not be a ":" or " text" in the filename
itself).
Anyways, good luck with the outcome of your make install :)
Almut
More information about the Techtalk
mailing list