Others have given working examples, but just for completeness and for showing off my nerdyness, another solution for bash and on systems with perl installed:

perl -pi -e "s/\r//" `find .`

The shell will expand the `find .` to a list of all files and directories in the current directory and below, and then execute the regex in-place on all those files.
(this is for converting from windows to unix, for the other way around replace the regex with "s/\r\n/\n/")
Disclaimer: it's just from memory, I haven't tested it but I used to use this method or a slight variation thereof.


Variant: if you only want to process .html files, change it to

perl -pi -e "s/\r//" `find . | grep html`

or more precisely

perl -pi -e "s/\r//" `find . | grep -e 'html$'`


cheers,

roel


Ehsan Akhgari wrote:

Hi everyone,

Appologies if this is OT.  I didn't know where to ask it, and I can't seem
to find what I'm after on the web.

What I need is a simple app/script which recursively checks everything
beneath a directory, and toggles the line ending format between Windows
format (\r\n) and Unix format (\n) automatically.  Nearly all the text
editors I use can do this for each file they're editing, but I don't know
how to do make them do it for all files inside a directory.  Since the file
number is big (over several thousand files), doing it manually isn't an
option.

So, before I start writing it myself, does any of you guys know of something
like that already available?  I can't believe this is not already possible
with some tool...  It doesn't matter if it works on Windows or Linux, BTW.

Thanks!
-------------
Ehsan Akhgari

Farda Technology (http://www.farda-tech.com/)

List Owner: [EMAIL PROTECTED]

[ Email: [EMAIL PROTECTED] ]
[ WWW: http://www.beginthread.com/Ehsan ]




_______________________________________________ msvc mailing list [EMAIL PROTECTED] See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for subscription changes, and list archive.





Reply via email to