Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11827

Re: Paste with null delimiter

From Eric Blake <eblake@redhat.com>
Newsgroups gnu.bash.bug
Subject Re: Paste with null delimiter
Date 2015-11-03 13:43 -0700
Organization Red Hat, Inc.
Message-ID <mailman.1617.1446583430.7904.bug-bash@gnu.org> (permalink)
References <3a207f09-fc2b-4a2e-a6e5-1d33c7479849@googlegroups.com> <5638F1C2.9000607@redhat.com> <CAJ=pi6=RkORqO+yGTzVikBKOpDFq7=7mrezjp5U+ge0LkfDFsQ@mail.gmail.com>

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

[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

Back to gnu.bash.bug | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Paste with null delimiter julio.neves@gmail.com - 2015-11-03 08:29 -0800
  Re: Paste with null delimiter Eric Blake <eblake@redhat.com> - 2015-11-03 10:41 -0700
  Re: Paste with null delimiter Andreas Schwab <schwab@linux-m68k.org> - 2015-11-03 18:47 +0100
  Re: Paste with null delimiter Eric Blake <eblake@redhat.com> - 2015-11-03 13:32 -0700
  Re: Paste with null delimiter Eric Blake <eblake@redhat.com> - 2015-11-03 13:43 -0700
  Re: Paste with null delimiter Eric Blake <eblake@redhat.com> - 2015-11-03 13:52 -0700
  Re: Paste with null delimiter Andreas Schwab <schwab@linux-m68k.org> - 2015-11-03 22:57 +0100
  Re: Paste with null delimiter Stephane Chazelas <stephane.chazelas@gmail.com> - 2015-11-04 15:44 +0000

csiph-web