Diff command script

I am trying to use the diff command on multiple files. I have a script like this:

diff -u <(head -n99999999 /tmp/*txt ) <(head -n99999999 *txt.z) |sed -e '/\-\//s/\-/deleting   /g'  -e '/\+\//s/\+/rearranging  /g' -e '/=\//s/\.*//g' -e '/txt.z/d' -e '/@/d' |gawk '$1 ~ /^deleting$/ || $1 ~ /^rearranging$/ || $1 ~ /==/ {print}' |gawk '/[txt]/{x="F"++i;}{print > x;}' 

The script works and creates F* files but the problem is that some items are marked as "deleting" which should not be. I found that when I run one file at a time it works fine:

diff -u <(head -n99999999 /tmp/product-txt ) <(head -n99999999 /tmp/product-txt.z)

I am wondering how to feed two files into the diff command at a time. I have tried multiple commands, such as paste (but I have over 12 files) and also tried using

sed -n "$count"p

in a script without success. I am sure that there is a read "script" that could be used with diff that would do it but I can't figure it out.

I really just need two files, one from txt and one from txt.z read into the diff command one at a time to compare the differences. Then the script should move on to the next pair. Ordinary diff doesn't work it will just run a check on 2 files and that's it. That is why I was using head -n999999.

Have you tried a loop?
Loop over the short names: it's easy to construct the 2nd name (simply add .z )

for f in *.txt
do
  if [ -f "$f" -a -f "$f".z ]
  then
    # both files exist
    diff -u "$f" "$f".z
  fi
done

... and I'm pretty sure that some or even most of your sed and awk pipes can be combined into one single awk command.

Thanks, made in Germany. I also found I could use sed -r and also the semicolon to combine the sed commands as Rudi mentioned!

Try to use the sub() or gsub() functions in awk to achieve what you are using the sed command for.