bash and unix commands: lesson #2

1) counting words


cat /usr/share/dict/words | wc -l

2) counting characters


cat /usr/share/dict/words | wc -c

 
3) replacing the ‘enter’ or ‘newline’ with comma


cat /usr/share/dict/words | tail -7 | tr '\n' ','
zymotoxic,zymurgy,Zyrenian,Zyrian,Zyryan,zythem,Zythia,

4) replacing more than a single character


cat /usr/share/dict/words | tail -7 | sed 's/Zy/Baaa/'
zymotoxic,zymurgy,Zyrenian,Zyrian,Zyryan,zythem,Zythia,