What do the text utilities on AIX have against following the manual and manipulating newlines properly? Is it just that AIX is from IBM, and IBM software is half-assed?
$ uname -a AIX myhost 3 5 00C2D2804C00 $ echo " 1 2 3 4 5 2 1" | tr -s [:space:] '\n' 1 2 3 4 5 2 1 $ echo " 1 2 3 4 5 2 1" | tr -s [:space:] '\012' 1 2 3 4 5 2 1 $ echo " 1 2 3 4 5 2 1" | sed 's/ /\n/g' n1n2n3n4nnn5n2n1
By properly, I of course mean “How GNU does it.”
$ uname -a Linux myhost 2.6.9-55.ELsmp #1 SMP Fri Apr 20 17:03:35 EDT 2007 i686 i686 i386 GNU/Linux $ echo " 1 2 3 4 5 2 1" | tr -s [:space:] '\n ' 1 2 3 4 5 2 1 $ echo " 1 2 3 4 5 2 1" | tr -s [:space:] '\012' 1 2 3 4 5 2 1 $ echo " 1 2 3 4 5 2 1" | sed 's/ /\n/g' 1 2 3 4 5 2 1
Turns out that tr(5) was not matching the class [:space:]
or the class [:blank:]
, but would match and transform the single character ' '
(space). Still not sure WTF is up with sed(5). The simple solution to this problem, of course, is to avoid AIX.