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.

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

share|improve this question
add comment

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
share|improve this answer
add comment

Your Answer

 
discard

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

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