-3
DR_CNDAOFSZAPZP_GPFS_VOL.0      139264
DR_CNDAOFSZAPZP_GPFS_VOL.1      15657
DR_CNDAOFSZAPZP_GPFS_VOL.0      139264
DR_CNDAOFSZAPZP_GPFS_VOL.1      156579
DR_CNDAOFSZAPZP_GPFS_VOL.2      156579
DR_CNDAOFSZAPZP_GPFS_VOL.3      156579
DR_CNDAOFSZAPZP_GPFS_VOL.5      172236

OutPut File1 ( with matching servers)

Server1                 Vzise
DR_CNDAOFSZAPZP_GPFS_VOL.0      278528
DR_CNDAOFSZAPZP_GPFS_VOL.1      172236

OutPut File2 ( with out matching servers)

DR_CNDAOFSZAPZP_GPFS_VOL.2      156579
DR_CNDAOFSZAPZP_GPFS_VOL.3      156579
DR_CNDAOFSZAPZP_GPFS_VOL.5      172236
0
$ awk '{Arr[$1]+=$2;Count[$1]++}END{for(i in Arr){if(Count[i]>1){print i,Arr[i] > "out_1"}else{print i,Arr[i] > "out_2"}}}' file1

$ ls -lrt
total 12
-rw-r--r--. 1 xxxxxxxxxxxxx yyyyyyyyyyyyyyyy 272 Nov 14 15:45 file1
-rw-r--r--. 1 xxxxxxxxxxxxx yyyyyyyyyyyyyyyy 102 Nov 14 15:48 out_2
-rw-r--r--. 1 xxxxxxxxxxxxx yyyyyyyyyyyyyyyy  68 Nov 14 15:48 out_1

$ cat out_1
DR_CNDAOFSZAPZP_GPFS_VOL.0 278528
DR_CNDAOFSZAPZP_GPFS_VOL.1 172236


$ cat out_2
DR_CNDAOFSZAPZP_GPFS_VOL.2 156579
DR_CNDAOFSZAPZP_GPFS_VOL.3 156579
DR_CNDAOFSZAPZP_GPFS_VOL.5 172236

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.