On Mon, 19 Apr 1999, Carl Mummert wrote: In case these aren't on a particular system, I've found this works well.
$ perl -pi -e 's/\r\n/\n/g' <filename> (DOS->UNIX) $ perl -pi -e 's/\n/\r\n/g' <filename> (UNIX->DOS) AFAIK it's the CR you want to remove (\r in perl) and not the newlines (\n). -Dano > Synopsis: file, created in Windows, won't execuate as shell script on > Linux box. > > Here is an 'od' dump of the first line of the file: > > > 0000000 # ! sp / b i n / s h cr nl > > The trick here is to get rid of the newlines. The easiest way I know > of is to use the 'fromdos' program, located in the 'sysutils' package. > > Just run > > $ fromdos file > > and the newlines go away. > > > For fun, you can run 'todos' on a working shell script -- it will stop > working. > Run 'fromdos' on it -- it will start working again.