Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a directory with files named like 19.png, 20.jpeg, and README00.txt

I want to rename these to 119.png, 120.jpeg, and README00.txt.

I would like to do this with zmv as it works well in so many other cases, but I cannot get zmv to make an action based on the first character of a filename being a digit. I can easily get 1README00.txt, but that is not what I desire.

share|improve this question
    
stackoverflow.com/questions/806906/… –  SHW Jun 21 '12 at 7:31
add comment

1 Answer

zmv '([0-9]*)' '1$1'

This adds a 1 in front of a filename which starts with a digit.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.