I am having many search results highlighted. While moving to everyone of them I want to visually select each search terms.

I have the following URLs in the whole file. I want to get the id_11169 part and replace the whole thing with 11169.jpg

/ImageVault/Images/id_11169/width_320/height_240/aspectRatio_1.3333/compressionQuality_80/scope_0/ImageVaultHandler.aspx

should become

11169.jpg

link|improve this question
feedback

1 Answer

Does this sample command work for you?

echo "/ImageVault/Images/id_11169/width_320/height_240/aspectRatio_1.3333/compressionQuality_80/scope_0/ImageVaultHandler.aspx" | sed 's|(id_[0-9]).|\1.jpg|g'

Would translate to the following vim command,

:%s/\(id_[0-9]*\).*/\1.jpg/g

Or, maybe you want just the basename, try this,

:%s/.*\(id_[0-9]*\).*/\1.jpg/g
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.