commands_used.sh 891 B

1234567891011121314151617181920212223242526
  1. #!/bin/bash
  2. # Take the numbers from raw_data and remove the dashes, redirect
  3. # to file id_number
  4. awk '/^[0-9].*/ { print $1 }' raw_data | sed 's/-//' | sed 's/-//' | sed 's/,$//' > id_number
  5. # Take the last names on the 2nd column, remove the line that
  6. # contains last, remove prior spaces from last names, add
  7. # colons, and redirect to file last_name
  8. cut -f2 -d, raw_data | sed '/last/ d' | sed 's/^ //' | sed 's/$/:/' > last_name
  9. # Take the first names on the 3rd column, use grep to show lines
  10. # that do not contain the word 'first', remove prior spaces from
  11. # first names, and redirect to file first_name
  12. cut -f3 -d, raw_data | grep -v 'first' | sed 's/^ //' > first_name
  13. # Combine the files first_name, last_name, and id_number in that
  14. # order, separated with a single space.
  15. paste -d\ first_name last_name id_number > final
  16. # concatenate the file final
  17. cat final
  18. # done!
  19. exit