I would use diff or sdiff, because i feel like it is a less hacked solution, and do some manipulation with the output with awk or a similar tool, if needed.
➜ ~ sdiff 1.txt 2.txt
1023M BLD | 1.2G BLD
123G DEV 123G DEV
945K Deployment | 345M Deployment
4899 INT | 499M INT
Then you can see the values which differ after the pipe symbol.
Grep it off to those only, like in the above answer:
➜ ~ sdiff 1.txt 2.txt | grep '|'
1023M BLD | 1.2G BLD
945K Deployment | 345M Deployment
4899 INT | 499M INT
I personally think this is a more smooth solution. To redirect just do:
➜ ~ sdiff 1.txt 2.txt | grep '|' > 3.txt
You can also use diff and grep to get only the fields which differ from first line:
➜ ~ diff 1.txt 2.txt | grep "^>"
> 1.2G BLD
> 345M Deployment
> 499M INT
file3
might look like, this is almost certainly the perfect use case forawk
.