Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let's say I have files in side a folder named

abc001.jpg
abc002.jpg
abc003.jpg
abc004.jpg
abc005.jpg
.
.
.
acb999.jpg

Let's say group1 is

  • abc001.jpg
  • abc002.jpg
  • abc005.jpg
  • abc010.jpg

and group2 is

  • abc003.jpg
  • abc004.jpg
  • abc009.jpg
  • abc111.jpg

I want to add a prefix like gr1 and gr2 according to the group they belong to, like:

  • gr1abc001.jpg
  • gr1abc002.jpg
  • gr1abc005.jpg
  • gr1abc010.jpg
  • gr2abc003.jpg
  • gr2abc004.jpg
  • gr2abc009.jpg

I need to do it using a shell script.

share|improve this question
1  
How do you define the group? Is it the group as defined in the permissions of the file? – Darth Android Jun 28 '12 at 14:11

You must log in to answer this question.

Browse other questions tagged .