KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am sure this is easy, I am just missing a character or two. I need to search for a particular term in a file, and when I find it, I need to append something to that line. And I want to do that for EVERY line with the match. To do it once, I can do this: /Thing to find/s/$/ Stuff to append/ Easy. And if my "thing to find" were at the END of the line I could do this: %s/\(Thing to find\)$/\1 Stuff to append/ To do the same thing on every matching line But how do I do the first thing on every line? I guess I could do %s/\(Thing to find.*\)$/\1 Stuff to append/ But that feels clumsy and would make it more complicated if the thing to find were on a line more than once. I am thinking there must be a way to just do my first search everywhere, but I am having trouble writing a concise enough description to google it. So mighty Stackers, anyone want to nerd slap me with a two byte solution?
Tags (comma-separated)
Save Edits
Cancel