Advertisement
saleemthp

Filter

Mar 1st, 2022
1,140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.41 KB | None | 0 0
  1. #!/bin/bash
  2. #sed -i '1s/^/Name Phone Number Jan Feb Mar\n/' move1.txt
  3. #1) Insert a heading line as follows to the top of the file and output the resulting data to a file called move1.txt.
  4. #Name Phone Number Jan Feb Mar
  5. #2) Duplicate the file in a file called move2.txt, except replace the name Hauschild with Housechild
  6. #3) Put the list of donors (only their full name, no other data) with area code 916 in a file called move3.txt
  7. #4) Anyone who's first names start with a M or R should go into a file called move4.txt, but only their first names.
  8. #5) Find the people who donated over $500.00 in any month in the file move5.txt. For this, I just want their full name and phone number, but nothing else. This data should be sorted by their last name.
  9.  
  10. #echo $"Name Phone Number Jan Feb Mar" >> move1.txt
  11. #echo $"Jane Smith, (314)314-123.\$10.00,\$50.00,\$15.00" >> move1.txt
  12. #echo $"Mark Hauschild, (916)-516-1234,\$5.00,\$75.00,\$25.25" >> move1.txt
  13. cp $1 move1.txt
  14. sed -i '1s/^/Name Phone Number Jan Feb Mar\n/' move1.txt
  15. #moving the contents of move1.txt to move2.txt
  16. cp move1.txt move2.txt
  17. #Replacing Hauschild with Housechild
  18. sed -i 's/Hauschild/Housechild/g' move2.txt
  19. #show area code with (916)
  20. grep '\(916\)' move2.txt | grep -o '^[^\,\]*' > move3.txt
  21. #sed -n '/\(916\)/p' move2.txt > move3.txt
  22. #Name Starting with M or R
  23. grep -E -o '^M.[^ ]*|^R.[^ ]*' move3.txt > move4.txt
  24. #grep -o '^[^ ]*' move3.txt > move4.txt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement