[Level 2] Join lines by sed commands.
If you want to join lines in shell script, you could use sed command.
regards,
Stanley Huang
#!/bin/bash cat > /tmp/t.txt <<EOF eth0 eth1 eth2 eth3 eth4 eth5 eth6 lo0 EOF sed -e :a -e '$!N; s/\n/,/; ta' /tmp/t.txt
$ ./joinLinesBySed.sh eth0,eth1,eth2,eth3,eth4,eth5,eth6,lo0Wish this helps.
regards,
Stanley Huang
Comments
Post a Comment