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.

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

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.