sed - Bash command to remove leading zeros from all file names -
i have directory bunch of files names like:
001234.jpg 001235.jpg 004729342.jpg
i want remove leading zeros file names, i'd left with:
1234.jpg 1235.jpg 4729342.jpg
i've been trying different configurations of sed, can't find proper syntax. there easy way list files in directory, pipe through sed, , either move or copy them new file name without leading zeros?
for file in `ls`; mv $file `echo $file | sed -e 's:^0*::'`; done
Comments
Post a Comment