0

I'm trying to take the 2 files below, and create a script to sort them into a new file of 3 column's with headers and some additional info.
I know the command to combine files and sort -- cat file1 file2 | sort > file3 but I don't know how to align the column's or add headings.

File 1

Dave 734.838.9800
Bob 313.123.4567
Carol 248.344.5576
Mary 313.449.1390
Ted 248-496-2204
Alice 616.556.4458

File 2

Bob Tuesday
Carol Monday
Ted Sunday
Alice Wednesday
Dave Thursday
Mary Saturday

Anticipated New File

Name        On-Call         Phone
Carol       MONDAY          248.344.5576
Bob         TUESDAY         313.123.4567
Alice       WEDNESDAY       616.556.4458
Dave        THURSDAY        734.838.9800
Mary        SATURDAY        313.449.1390
Ted         SUNDAY          248.496.2204
George Vasiliou
  • 6,130
  • 2
  • 20
  • 27
Ari
  • 1
  • 2
    Is this a kind of school exercise that repeats over the years? This question 2 years ago is identical. It has the same names (!) and identical phone numbers !! : https://unix.stackexchange.com/questions/197339/how-to-sort-by-the-day-of-the-week – George Vasiliou Apr 21 '17 at 20:13
  • 1
    And this one answers directly your current question : https://unix.stackexchange.com/questions/197250/how-to-merge-two-files-in-the-same-row/197267 PS: Try to google `Carol 248.344.5576` and you will be surprised by the results. – George Vasiliou Apr 21 '17 at 20:16
  • Possible duplicate of [Loops in Shell Scripting](http://stackoverflow.com/questions/780305/loops-in-shell-scripting) – Roger Sinasohn Apr 22 '17 at 18:22

0 Answers0