Skip to content

Instantly share code, notes, and snippets.

@waleedsamy
Last active July 16, 2018 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waleedsamy/d86a11d673a6a478ef5e9ee8f1d71d83 to your computer and use it in GitHub Desktop.
Save waleedsamy/d86a11d673a6a478ef5e9ee8f1d71d83 to your computer and use it in GitHub Desktop.
Use AWK to add numbers from two files
awk 'FNR==NR{a[NR]=$1;next}{ print $0 " + " a[FNR] " = " $0+a[FNR]}' total-time-317.log total-time-330.log
3802
3750
13600
3238
19554
20293
19979
13266
10928
4734
4049
12993
3577
17387
21282
18144
12125
12451
@waleedsamy
Copy link
Author

waleedsamy commented Jul 16, 2018

output:

4734 + 3802 = 8536
4049 + 3750 = 7799
12993 + 13600 = 26593
3577 + 3238 = 6815
17387 + 19554 = 36941
21282 + 20293 = 41575
18144 + 19979 = 38123
12125 + 13266 = 25391
12451 + 10928 = 23379

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment