Linux is for everybody. Lets enjoy it.
$ echo "one two three" | sed 's/ /\n/g'onetwothree
$ echo "one two three" | awk '$1=$1' RS= OFS="\n"onetwothree
$ echo "one two three" | tr -s ' ' '\n'onetwothree
Thks for posta more generic space mgt with tr is to use label, it will work whatever is space or tabecho "one two three" | tr -s '[:space:]' '\n'onetwothreea more generic char mgt with tr is to use octalecho "one two three" | tr -s '\040' '\012'onetwothreean easy way to caych octal value is odecho "one two three" | od -cto10000000 o n e t w o t h r e e \n 157 156 145 040 164 167 157 040 164 150 162 145 145 0120000016
Just a heads up, the sed version won't work on a mac.http://stackoverflow.com/questions/10748453/replace-comma-with-newline-in-sed
Thks for post
ReplyDeletea more generic space mgt with tr is to use label, it will work whatever is space or tab
echo "one two three" | tr -s '[:space:]' '\n'
one
two
three
a more generic char mgt with tr is to use octal
echo "one two three" | tr -s '\040' '\012'
one
two
three
an easy way to caych octal value is od
echo "one two three" | od -cto1
0000000 o n e t w o t h r e e \n
157 156 145 040 164 167 157 040 164 150 162 145 145 012
0000016
Just a heads up, the sed version won't work on a mac.
ReplyDeletehttp://stackoverflow.com/questions/10748453/replace-comma-with-newline-in-sed