[clug] Circumflex

Scott Ferguson scott.ferguson.clug at gmail.com
Mon Aug 21 10:03:48 UTC 2017



On 21/08/17 19:08, Sam Parkinson via linux wrote:
> On Mon, 2017-08-21 at 04:21 +1000, Bryan Kilgallin (iiNet) via linux
> wrote:
>> Thanks again Scott:
>>
>> The problem was with the sample text file. I think that some
>> unfortunate 
>> CR/LF line-ending combination had caused trouble.
> 
> Ah, the "dos2unix" command is pretty good at fixing this!  It seems to
> be installed by default on Fedora at least.

Interesting (and noted for future references) - it's not installed by
default on Debian, though "file" is (and "sed").

$ dos2unix -V
dos2unix 7.3.4 (2016-05-24)
With Unicode UTF-16 support.
With native language support.
LOCALEDIR: /usr/share/locale
http://waterlan.home.xs4all.nl/dos2unix.html
#Debian Stretch

Apropos of little the switches that Bryan didn't understand/couldn't
find/weren't supported on his "Linux" (Ubuntu?) is:-

       -i[FLAGS], --info[=FLAGS] FILE ...
           Display file information. No conversion is done.

           The following information is printed, in this order: number
of DOS line breaks, number of Unix
           line breaks, number of Mac line breaks, byte order mark, text
or binary, file name.

           Example output:

                6       0       0  no_bom    text    dos.txt
                0       6       0  no_bom    text    unix.txt
                0       0       6  no_bom    text    mac.txt
                6       6       6  no_bom    text    mixed.txt
               50       0       0  UTF-16LE  text    utf16le.txt
                0      50       0  no_bom    text    utf8unix.txt
               50       0       0  UTF-8     text    utf8dos.txt
                2     418     219  no_bom    binary  dos2unix.exe

           Note that sometimes a binary file can be mistaken for a text
file. See also option "-s".

           Optionally extra flags can be set to change the output. One
or more flags can be added.
====================================

          c   Print only the files that would be converted.

               With the "c" flag dos2unix will print only the files that
contain DOS line breaks, unix2dos
               will print only file names that have Unix line breaks.
====================================

So, if I understand the man file correctly, "dos2unix -ic *.txt" will
check every file in a given directory, list only files that have
MS-DOS-style carriage returns, and parse them without changing the
timestamps.
<snipped>


Kind regards

-- 
    A: Because we read from top to bottom, left to right.
    Q: Why should I start my reply below the quoted text?

    A: Because it messes up the order in which people normally read text.
    Q: Why is top-posting such a bad thing?

    A: The lost context.
    Q: What makes top-posted replies harder to read than bottom-posted?

    A: Yes.
    Q: Should I trim down the quoted part of an email to which I'm reply

http://www.idallen.com/topposting.html



More information about the linux mailing list