Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #part a. count number of lines
  4. echo "Number of lines in both text files:"
  5. wc -l ATaleofTwoCities.txt AliceInWonderland.txt
  6.  
  7. #part b. count word london/paris
  8. echo "'London' appears " $(grep -c 'London' ATaleofTwoCities.txt) " times."
  9. #grep -c 'London' ATaleofTwoCities.txt
  10. echo "'Paris' appears " $(grep -c 'Paris' ATaleofTwoCities.txt) " times."
  11. #grep -c 'Paris' ATaleofTwoCities.txt
  12.  
  13. #part c. count vowels, count the and replace with 'ABC'
  14. echo "Number of vowels in ATaleofTwoCities: " $(egrep -ci 'a|e|i|o|u' ATaleofTwoCities.txt)
  15. echo "Numbers of vowels in AliceInWonderland: " $(egrep -ci 'a|e|i|o|u' AliceInWonderland.txt)
  16.  
  17. echo "'the' appears " $(grep -cw 'the' ATaleofTwoCities.txt) " times in ATaleofTwoCities."
  18. echo "'the' appears " $(grep -cw 'the' AliceInWonderland.txt) " times in AliceInWonderland."
  19. sed -i 's/the/ABC/g' ATaleofTwoCities.txt
  20. sed -i 's/the/ABC/g' AliceInWonderland.txt
  21.  
  22. #part d. print all different types of characters
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement