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' ','

4) replacing more than a single character

cat /usr/share/dict/words | tail -7 | sed 's/Zy/Baaa/'

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

Leave a Reply

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

You are commenting using your 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