sh Scripting - String Manipulation

Drew Tomlinson drew at mykitchentable.net
Fri Oct 14 08:44:36 PDT 2005


On 10/13/2005 6:43 PM Kirk Strauser wrote:

>On Thursday 13 October 2005 06:04 pm, Drew Tomlinson wrote:
>
>  
>
>>What I'd like to is get '-exec' to run this command:
>>
>>ln -s "/multimedia/Pictures/2005 Kimberly & Rich/IMG_1210.JPG" "2005
>>Kimberly & Rich/IMG_1210.JPG"
>>    
>>
>
>The easiest way I've found is to simply change into /multimedia/Pictures 
>before running find, then refer "ln" back to your original directory.
>
>Say that you want the links to be made inside /home/drew .  Instead of running 
>find from their, do:
>
>    $ cd /multimedia/Pictures
>    $ find -iname '*.jpg' -exec ln -s {} /home/drew
>
>There - you've removed any need for string manipulation with a simple cd.
>  
>

Thanks for your reply.  This is a good workaround in this particular 
situation for getting it done quickly.  However I hope to learn how to 
actually manipulate the string for future reference.  I've done some 
reading and played with awk and sed a little but I can't get either to 
behave as I expect.  If awk and/or sed seem to be the best solution, 
I'll post again with specific questions.

Thanks,

Drew

-- 
Visit The Alchemist's Warehouse
Magic Tricks, DVDs, Videos, Books, & More!

http://www.alchemistswarehouse.com



More information about the freebsd-questions mailing list