I want to produce a list of files between 14 and 22 April.
The filenames will have the date in the name, e.g. J0018658.WANCL90A.16Apr2014.214001.STD.txt.
I have tried this script.
for i in 14 15 16 17 18 19 20 21 22; do
for x in *$iApr*.txt; do
echo "$x"
done
done
I am using this on AIX and the default shell is ksh. However sh and bash are also available. Here is what works with ksh:
for i in 14 15 16 17 18 19 20 21 22; do
for x in *${i}Apr*.txt; do
echo "$x"
done
done
Here is what works even better with bash:
#!/bin/bash
shopt -s nullglob
for i in {14..22}; do
for x in *${i}Apr*.txt; do
echo "$x"
done
done