Remove Files of given range in bash/shell/unix -


i have files of below name format.

test_1_452161_987654321.arc   test_1_452162_987654321.arc   test_1_452163_987654321.arc   .   .   .   test_1_452190_987654321.arc  

i.e need delete 30 files in above case user give below inputs

start_file = 452161   end_file   =  452190 

how delete above series files? (i new bash/shell programming tried using while loop , remove dint work seeking experts help)

my code

echo "enter start file" read start echo "enter end file" read end  i=$start j=$end  while [$i -le $j]; rm *$i*.arc ((i++)) done 

replace after fourth line by

for ((i=$start; i<=$end; i++));   echo rm *_${i}_*.arc done 

if looks fine, remove echo.


Comments

Popular posts from this blog

android - ConstraintLayout: Realign baseline constraint in case if dependent view visibility was set to GONE -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -