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,

One thought on “bash and unix commands: lesson #2

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s