I have the following command that takes a certain part of a file in the current directory, writes it to a temporary file, gets a part of another file one directory up, writes it to a temporary file and then finally concatenates these two temporary files into one and outputs it to
sed -e '3003,$d' file1 > temp1;sed -n '3,$p' ../otherfile1 > temp2; cat temp1 temp2 > ../result1
This works for one file, but now I want to do this to a whole directory.
I thought that using a wildcard in the sed command would work:
sed -e '3003,$d' file* > temp1;sed -n '3,$p' ../otherfile* > temp2; cat temp1 temp2 > ../result*
but then of course it doesn't automagically know how to number the temporary files and the output file.
How can I use this command on a whole directory, outputting a unique result file for every concatenation?