I have 2 files,file1 -> 12235file2 ->1326I want to the output to be stored in a 3rd file called file3 as1,1,Match2,2,Match2,,NoMatch3,3,Match5,,NoMatch ,6,NoMatchI am new to shell scripting and I've tried, sort file1 > file1sorted.txtsort file2 > file2sorted.txt# Combine the sorted files with a comma and store it in a new filepaste -d ',' file1sorted.txt file2sorted.txt   > mergedsortedfile.txt# Compare the columns and store the result in a new fileawk -F',' '{print $1 == $2 ? MATCH : NO MATCH}' mergedsortedfile.txt > result.txt# Merge the result file with the already existing merged filepaste -d ', ' mergedsortedfile.txt result.txt > final_result.txtThe result appears like this,1,1,MATCH2,2,MATCH2,3,NO MATCH3,6,NO MATCH5,,NO MATCHAny help would be great. Please let me know if you need more information.Thank you
Compare 2 files and store the output as file1_value,file2_value,Match/NoMatch
shell script;text processing
Using comm on the sorted data:$  comm <( sort -n file1 ) <( sort -n file2 )                1                22                35        6This output is tab-delimited. We can mark everything in columns 1 and 2 as NoMatch and in column 3 as Match with awk:$ comm  <( sort -n file1 ) <( sort -n file2 ) |  awk -F$'\t' 'BEGIN { OFS=, } $3 { print $3, $3, Match; next } { print $1, $2, NoMatch }'1,1,Match2,2,Match2,,NoMatch3,3,Match5,,NoMatch,6,NoMatchThe awk script will read tab-delimited input (-F$'\t') and use commas for the output field delimiter (OFS=,).  If there's something in field 3, then it will output it twice with Match in the third field and continue with the next line.  Otherwise, it will output fields 1 and 2 from the input together with NoMatch in the third field.