Apologies, I am new to the linux environment. I am attempting to create a .sh file that puts files depending on their file name into a .txt with the file names corressponding to the day of the year. Rather than having the .sh file have 365 lines for each day of the year is there a way to loop through in daily increments?
currently I am using
ls A2018001* > A2018001.txt
ls A2018002* > A2018002.txt
ls A2018003* > A2018003.txt
ls A2018004* > A2018004.txt
etc..
Which is okay but is there a way to avoid having 365 lines of code in the .sh with a loop?
One way:
for i in {2018001..2018365}
do
ls A${i}* > A${i}.txt
done
Generate the loop for 1 to 365 and then list the files and redirect.