On 2020-05-31 00:31, Assaf Gordon wrote: > Hello, > > On 2020-05-30 3:59 p.m., Bertrand Jacquin wrote: > [...] >> This definitely make sense >> >>>> $ sha256sum -C /etc fstab >>>> b5d6c0e5e6bc419b134478ad7b3e7c8cc628049876a7772cea469e81e4b0e0e5 >>>> fstab >>> >>> The net effect is that just the output has changed to omit the path >>> name. >>> >>> Maybe this wants to be a --strip or -p option like with diff or patch, >>> or --basename-only to strip a variable number of components, leaving >>> only >>> the last. >> >> This seems to be a better approach indeed. I just sent a new patch using >> base_name from coreutils itself.
@Bertrand: thanks for the report and especially the patch: this is a very positive example to have something concrete for discussion. > The GNU Datamash program can do basename and dirname on a column of a > text file, producing the wanted results (and more): > > $ md5sum /etc/fstab world.txt | datamash -W --full basename 2 dirname 2 > b50f98cdf2d6e26a99040ad5386b0884 /etc/fstab fstab /etc > b1946ac92492d2347c6235b4d2611184 world.txt world.txt . > > And this will work on any input without the need to duplicate > functionality in multiple programs. Indeed, this is yet another of the many ways to strip the file name as already mentioned. Furthermore, adding such a new option would therefore not only add code complexity, but also break the usual case where a *sum tool creates a list of checksums which then can be verified in another run with the -c option. Thus, I'm not so enthusiastic either to add such an option. Have a nice day, Berny