bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Paste with null delimiter


From: Eric Blake
Subject: Re: Paste with null delimiter
Date: Tue, 3 Nov 2015 13:43:37 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

[adding the list back in with permission; please don't send private
mails when the discussion may benefit others]

[please don't top-post on technical lists]

On 11/03/2015 11:03 AM, Julio C. Neves wrote:
> Hi Eric, I wrote NUL because my english is not the best of the world, I
> wanna mean "empty" delimiter, I was not trying to use the binary zeroes as
> delimiter.
> 
> Using a space between the option and the delimiter it works fine, but if
> you take off this space, the first file disapears.
> 
> I can't agree that
> 
> paste -d odd even
> 
> is the same as:
> 
> paste -d odd even
> 

I think you typed that wrong, because what you typed is identical.

> In the 1st case we are specifying the delimiters as o, d and d again
> 
> let's use the -s option:
> 
> $ paste -sd odd even     # o, d & d are the delimiters
> 2o4d6d8o10
> $ paste -sd "" odd even  # An empty delimiter
> 13579
> 246810
> $ paste -sd"" odd even   # The same as the 1st
> 2o4d6d8o10

Remember, the shell strips quotes before creating the argv[] handed to
the paste process.  So 'paste -sd"" odd even' is indeed identical to
'paste -sd odd even' - by the time the quotes are stripped, you are left
with the same argv[] contents.

The space is absolutely important because it is what creates an argv of
["paste", "-sd", "", "odd", "even"] - once the quotes are stripped, you
are still left with an empty argument, but only if those quotes that
were trying to delineate an empty string weren't adjacent to anything else.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]