|
From: | Assaf Gordon |
Subject: | Re: [PATCH] md5sum: add an option to change directory |
Date: | Sat, 30 May 2020 16:31:31 -0600 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 |
Hello, On 2020-05-30 3:59 p.m., Bertrand Jacquin wrote: [...]
This definitely make sense$ sha256sum -C /etc fstab b5d6c0e5e6bc419b134478ad7b3e7c8cc628049876a7772cea469e81e4b0e0e5 fstabThe 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.
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. -assaf
[Prev in Thread] | Current Thread | [Next in Thread] |