[LINUX] Erase & generate serial number files with shell script

Make a serial number

You can use the command seq, but if you want to specify the number of digits, use the -f option. "Seq -f% 0 digits first number last number" Anyway. Don't forget to write 0 ...


for NUMPATH in `seq -f %05g 1 96`
 echo "flow_z${NUMPATH}_0000950000"

The execution result is as follows

rm flow_z00081_0000010000
rm flow_z00095_0000950000
rm flow_z00096_0000950000

Usage example

If you want to delete a serial number file, but the wildcard exceeds the limit, you can not write it well, and it is difficult to use a regular expression, you can handle it with the above code.

Recommended Posts

Erase & generate serial number files with shell script
Process the files in the folder in order with a shell script
[Python] Easy reading of serial number image files with OpenCV
Automate environment construction with Shell Script
Import serial number videos together with Aviutl
Manage logrotate generations with a shell script.
Web scraping with BeautifulSoup4 (serial number page)
View today's weather forecast with a shell script
Erase image files at once with one liner
Shell script basics # 2
Display serial number columns and variables with Bottle template