Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a bunch of files (around 900) that have some special characters.

Some of the files contains example, and quoting "[useless] filename (something)" so what I want is just to strip the brackets and parenthesis, some are folders, others are text files

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

Debian comes with a program called prename which can rename files using regexes:

prename 's/^\[.+?\] *//; s/ \(.+?\)$//' *
share|improve this answer
    
Use -v for verbose and -n to preview the results (and do nothing). This way you can check the result first. –  Geoff Mar 23 '11 at 19:50
    
thanks a lot you two :) –  allenskd Mar 23 '11 at 22:51
    
sorry, my regex skill sucks so I ask.. there are some files with brackets parenthesis on both sides, but that code only removes the starting line :( –  allenskd Mar 24 '11 at 21:10
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.