in reply to dos2unix problem

I used to do the following from the shell:
$ cat dosfile.txt | tr -d "\r" > unixfile.txt

--
tune

Replies are listed 'Best First'.
Re: Re: dos2unix problem
by tommyw (Hermit) on Oct 09, 2001 at 21:40 UTC

    Arggh! Not the dreaded "cat a single file into a pipe" command!

    This can always be replaced more efficiently by simply redirecting STDIN on the recieving command. Thus the example becomes

    $ tr -d "\r" < dosfile.txt > unixfile.txt
    which saves (approximately :) one process and two file handles.

    Of course, if you've got two files, you simply can't do this. And if the pipeline command is being generated from a script, the ease of building it this way may outway the efficiency of avoiding the extraneous "cat"