Lets say I have a list of servers a mile long to visit. Got a help desk request with the servers listed separated by commas.
server1,server2,server3
Lets say It is actually about 30 or 40 servers and I’m too lazy to edit the list
echo “server1,server2,server3” > olist
awk -F, -v nr=1 ‘{ for (x=nr; x<=NF; x++) {printf $x ” \n”; }; print ” ” }’ olist
Output:
server1
server2
server3
Plug and play time here, you can take care of any delimited format like this.
Spaces input by wordpress (thanks)
Another way:
~ >print “1,2,3” | tr ‘,’ ‘\n’
1
2
3
~ >