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

Bob


_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to