[prev in list] [next in list] [prev in thread] [next in thread] 

List:       coreutils
Subject:    Re: New option for md5sum
From:       Pádraig_Brady <P () draigBrady ! com>
Date:       2014-04-19 8:56:36
Message-ID: 53523A44.1040600 () draigBrady ! com
[Download RAW message or body]

On 04/19/2014 08:58 AM, Andreas Schwab wrote:
> Bernhard Voelker
> <mail-hQE9kZqPbDRht4tGq10puRvVK+yQ3ZXh@public.gmane.org> writes:
> 
>> On 04/19/2014 04:48 AM, Bob Proulx wrote:
>>> Rather than cut and using an exact number of characters I prefer to
>>> use awk to cut by fields.  That way it works with all of the *sum
>>> programs.
>>>
>>>   $ md5sum /dev/null | awk '{print$1}'
>>
>> And there are many other ways:
>>
>>   # using the field option of cut:
>>   $ md5sum /dev/null | src/cut -d ' ' -f 1
>>   d41d8cd98f00b204e9800998ecf8427e
>>
>>   $ md5sum /dev/null | sed 's/ .*$//'
>>   d41d8cd98f00b204e9800998ecf8427e
> 
> None of them handle quoted file names:
> 
> $ md5sum a\\b | awk '{print$1}'
> \d41d8cd98f00b204e9800998ecf8427e

The first proposed option using indirection does.
If that's awkward from a programmatic context,
then in such a context it would be trivial
(albeit not obvious) to strip.

Pádraig.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic