I have a folder with about 450k images in sequentially numbered. However, from about 0-200k there are quite a few gaps. I want to only zip any of the images from 0-200k into a folder.
I've been looking and grep -E keeps coming up but it looks like I'd have to specify all the ranges every 100 which isn't great.
Is there a quicker way to do it (on amazon linux)
The images are named 1.jpg, 2.jpg, 3.jpg and so on to 199999.jpg
Not sure about amazon linux but it worked on Ubuntu 17.10:
tar -czvf up_to_200K.tar.gz `for FILE in $(ls|grep -oP '^\d+(?=.jpg)'); do if [ $FILE -le 200000 ]; then echo $FILE.jpg;fi;done | xargs`