After creating numerous files named ‘kupu-xxx.txt’ I had BBEdit run through the folder to remove the ‘jxzq’ and a couple of new lines from each file in bulk. Then this command renamed each file with the contents of the first line: for i in *; do mv “$i” “$(head -1 “$i”)"; done .

A list of filenames.