Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #grep for the INSERT into statements
  4.  
  5. #count number of agents in txt files
  6. agentsText=$(grep -iwc "INSERT INTO" agents.sql)
  7.  
  8. #count number of dealers
  9. dealersCount=$(grep -iwc "INSERT INTO" dealers.sql)
  10.  
  11. #count number of owners
  12. ownersCount=$(grep -iwc "INSERT INTO" owners.sql)
  13.  
  14. #owners count in .txt
  15. ownersCountTXT=$(grep -iwvc "Dealer Name" SALESDATA/dealerships.txt)
  16.  
  17. #count Alabama usage?
  18. alabamaCount=$(grep -iwc "AL" dealers.sql)
  19.  
  20. #count number of dealerships owned by Walker
  21. #then save it, count # of owners with last name of Walker
  22. walkerDealCount=$(grep -iwc "Walker" SALESDATA/dealerships.txt)
  23.  
  24. walkerOwnerCount=$(grep -iwc "Walker" owners.sql)
  25.  
  26. #adding 4 to my owners count because there is no .txt for owners
  27.  
  28. echo "Initial Data File Counts"
  29. echo "Agents: DATA=$agentsText SQL=$agentsText"
  30. echo "Dealers: DATA=$dealersCount SQL=$dealersCount"
  31. echo "Owners: DATA=$ownersCountTXT SQL=$ownersCount"
  32. echo "Alabama: DATA=$alabamaCount SQL=$alabamaCount"
  33. echo "Walker: DATA=$walkerDealCount SQL=$walkerOwnerCount"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement