Artificial intelligent assistant

How to compare corresponding multiple files with each other in the same directory Hi so I have a folder like `/mell/908` which contains files as follows: cf-mell-pos-908-tcg-4619e.txt cf-mell-pos-908-tcw-4619e.txt cf-mell-pos-908-usc-4619e.txt cf-mell-pos-908-wi_board-4619e.txt copper_qnt tcg_mell_upload_lx.txt tcw_mell_upload_lx.txt usc_mell_upload_lx.txt wi_board_mell_upload_lx.txt Is there a way I can use the `diff` command to compare the corresponding files * `cf-mell-pos-908-tcg-4619e.txt` and `tcg_mell_upload_lx.txt` * `cf-mell-pos-908-tcw-4619e.txt` and `tcw_mell_upload_lx.txt` and so on with each other without having to `diff` manually each pair one by one? I am running a Linux system.

I propose this option, assuming the string that matches in every pair of files is always in the same position:


# loop over the files that start with 'cf-'
for f in cf-*.txt; do
# extract the unique "code", e.g 'tcg'
code=$(echo "$f" | cut -d'-' -f5)

# match the looped file with the one that starts with the "code"
echo "diff" *"-${code}"* "${code}"*.txt

# perform your commands, in this case I use an `echo` to show
# how the command `diff` will be executed
done

diff cf-mell-pos-908-tcg-4619e.txt tcg_mell_upload_lx.txt
diff cf-mell-pos-908-tcw-4619e.txt tcw_mell_upload_lx.txt
diff cf-mell-pos-908-usc-4619e.txt usc_mell_upload_lx.txt
diff cf-mell-pos-908-wi_board-4619e.txt wi_board_mell_upload_lx.txt

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 7df073390dd302643db16505ed1e93be