Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #part a. count number of lines
- echo "Number of lines in both text files:"
- wc -l ATaleofTwoCities.txt AliceInWonderland.txt
- #part b. count word london/paris
- echo "'London' appears " $(grep -c 'London' ATaleofTwoCities.txt) " times."
- #grep -c 'London' ATaleofTwoCities.txt
- echo "'Paris' appears " $(grep -c 'Paris' ATaleofTwoCities.txt) " times."
- #grep -c 'Paris' ATaleofTwoCities.txt
- #part c. count vowels, count the and replace with 'ABC'
- echo "Number of vowels in ATaleofTwoCities: " $(egrep -ci 'a|e|i|o|u' ATaleofTwoCities.txt)
- echo "Numbers of vowels in AliceInWonderland: " $(egrep -ci 'a|e|i|o|u' AliceInWonderland.txt)
- echo "'the' appears " $(grep -cw 'the' ATaleofTwoCities.txt) " times in ATaleofTwoCities."
- echo "'the' appears " $(grep -cw 'the' AliceInWonderland.txt) " times in AliceInWonderland."
- sed -i 's/the/ABC/g' ATaleofTwoCities.txt
- sed -i 's/the/ABC/g' AliceInWonderland.txt
- #part d. print all different types of characters
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement