I am comparing multiple files in a while loop and storing the output in new files.
I am doing like below
while IFS='|' read -r work_table_name final_table_name;do
comm -23 <(sort /home/$USER/work_schema/${work_table_name}_work_schema.txt) <(sort /home/$USER/final_schema/${final_table_name}_final_schema.txt) > /home/$USER/mismatched_schema/${final_table_name}.txt
done < /home/$USER/tables.txt
I am getting what I want. But just need a bit of result of the whole while
loop.
I want to create files only when there is a mismatch between the files. If there is no mismatch then don't create a file at all.
How can I achieve that?