* Challenging Shell Script
@ 2005-09-03 8:38 vick Julius
2005-09-03 13:08 ` Arvind
0 siblings, 1 reply; 2+ messages in thread
From: vick Julius @ 2005-09-03 8:38 UTC (permalink / raw)
To: linux-admin
I have a folder of digital images MV1000.jpg, MV1001.jpg, MV1002.jpg,....
These images correspond to a list of hardware items. This list is in a text
file items.txt as follow:
ID Description // this line can be removed from the file
500 screw driver philips
501 camera digital canon
502 laser printer samsung
etc...
The image MV1000.jpg corresponds to the first item in the list, i.e. 500
screw driver philips and the second image, MV1001.jpg corresponds to the
second item in the list, i.e. 501 camera digital canon and so on.
I want to rename the images in the following way:
The name of each image should be made of: 3 letters which are the first
letters of each word in the line from items.txt file (screw driver philips
would be sdp) followed by the ID of the item.
For example:
MV1000.jpg should be sdp500.jpg
MV1001.jpg should be cdc501.jpg
MV1002.jpg should be lps502.jpg
Thank you
Vick
_________________________________________________________________
Don't just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Challenging Shell Script
2005-09-03 8:38 Challenging Shell Script vick Julius
@ 2005-09-03 13:08 ` Arvind
0 siblings, 0 replies; 2+ messages in thread
From: Arvind @ 2005-09-03 13:08 UTC (permalink / raw)
To: linux-admin
[-- Attachment #1: Type: text/plain, Size: 355 bytes --]
Hi,
> This list is in a text file items.txt as follow:
>
> 500 screw driver philips
> 501 camera digital canon
> 502 laser printer samsung
> etc...
sed 's/\([0-9]*\) *\(.\)[^ ]* *\(.\)[^ ]* *\(.\).*/\2\3\4\1/' items.txt
I'll let you do the rest.
Arvind
--
Everyone is more or less mad on one point.
-- Rudyard Kipling
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-09-03 13:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-03 8:38 Challenging Shell Script vick Julius
2005-09-03 13:08 ` Arvind
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).