I have a series of files that are named according to
field.%d.vtk and are generated when I run a C++ code. The codes does a series of computation inside a for-loop and dumps the output whenever
i%N == 0 where
i is the loop variable and
N is a constant. By mistake I have set
N = 1 and now I have huge amount of data that I do not need. I also do not want to rerun the code.
How can I write a bash script to only keep every
N files, delete the rest, and rename the remaining files such that numbers in
field.%d.vtk are contiguous? Sorry if this is trivial, but I have very limited experience with bash scripting.
N=1 (by mistake) range of
%d would be in [0, 1, ..., O(100,000)] (really large) a suitable
N is something around
N=100 which would shrink down the number of files to O(1000) or so.