macosunixmanuals

Unable to compare all GNU Unix manuals with all Unix Manuals in Mac


I would like to compare all GNU Unix manuals and and Mac's Unix manuals by sdiff.

I do not know how you go through, for instance, all Mac's Unix manuals and then save them to a file.

The comparison can be done by the following code when the manuals are in two files

sdiff <(file1) <(file2)

Perhaps, there is some index of Unix command names such that we can do the following

sdiff <(man *[in the index]) <(man *[in the index])

How can you compare all GNU Unix manuals with all Unix manuals in Mac?

[edit]

Mac's manuals are at /usr/share/man/man[1-9]/*. I have an encoding problem with them when I try to cat them.

Another problem is to find the location of Coreutils' manuals.


Solution

  • Your goal, to identify the differing parameters for the different BSD vs GNU/Linux versions of the various programs, is going to be somewhat tedious. It's useful to note that there are other variants of all commands as well. There are system V versions and BSD versions and GNU versions, and the Mac uses a mish-mash of all 3. In any event, as a starting point, the files themselves are filled with formatting macros that you have no interest in. Pipe the output of man through 'col -b' to get data you can diff. In terms of generating the list of commands, you could just ls -1 /bin /usr/bin' Then something like this would get you most of the way:

    while read command ; do
        man $command | col -b > output1
        man ./path/to/GNU/$command | col -b > output2
        diff  output1 output2  |  grep  '^[ ]*-' > $command.diffs
     done<<EOF
     diff
     grep
     sort
     ...
     ...
     EOF