Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 1
    Why do you want to use a regular expression? Commented Nov 29, 2013 at 18:03
  • You might find the answer to this question a guide to what you want to do. stackoverflow.com/questions/13278391/… Commented Nov 29, 2013 at 18:11
  • I just assumed that a regular expression would be the only way to do it. Now I know that I was wrong. Commented Nov 29, 2013 at 18:33
  • Yeah, if its fixed format, probably don't need a regex. But, if badly formed filename sneaks in, a regex can give you more options for a recovery. Commented Nov 29, 2013 at 19:15
  • Not complete, but I use something like: for a in *; do b=$(echo $a | perl -pe 's/^\d(\d\d)/\1/'); mv "$a" "$b"; done Commented Mar 13, 2014 at 14:46