[Top][All Lists]

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

Re: tac --separator

From: Bob Proulx
Subject: Re: tac --separator
Date: Mon, 4 Feb 2008 10:42:10 -0700
User-agent: Mutt/1.5.13 (2006-08-11)

Erkan Yanar wrote:
> $ echo -e "a b c d"| tac  --separator=" " 
> d
> c b a
> Why is tac only using the first space as separator?

It is using all of the spaces.  See that "c b a" is reversed.  But the
problem is that the "d" is not terminated.

  printf "a\nb\nc\nd\n" | tac | od -c -tx1
  0000000   d  \n   c  \n   b  \n   a  \n
          64 0a 63 0a 62 0a 61 0a

All good because every record has a terminator.

Try this to add a space terminator:

  printf "a b c d " | tac --separator=" " ; echo
  d c b a 

  printf "a b c d " | tac --separator=" " | od -c -tx1
  0000000   d       c       b       a    
          64 20 63 20 62 20 61 20


reply via email to

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