I have a bunch of files and these files come with pair. For example:
File1_1.tar.gz, File1_2.tar.gz File2_1.tar.gz, File2_2.tar.gz ... I take first pair and execute bunch of commands and get output, then I proceed to second pair. But I can only do this if the folder have two files like File1_1.tar.gz, File1_2.tar.gz after that I delete these and add second pair by hand. I take filenames from directory like this
FILE_1=$(ls | sort -n | head -n 1) FILE_2=$(ls | sort -n | tail -n 1) I would like do it with for loop like take the first two pair get output then take second pair get output and so on.