Is there a way to have s;/;|;g
run only on the lines I filter using a regex?
I have a file, which looks like:
Date: 2017/08/18
Path /home/share/thing
Path /home/me/thing
Date: 2017/08/18
Path /home/share/thing
Date: 2017/08/18
Path /home/share/thing
Path /home/me/thing
...
Now this is simplified, but the point is I want to substitute the /
on the lines beginning with Path
, but not the ones beginning with Date
. I can grab all of the lines with Path
easily enough (:g/Path
) and substitute all of the /
s (:%s;/;|;g
), but for substituting on the specific lines I only know how to give s
a range, which doesn't help much.
It seems like it would be easiest if you could pipe the output of g
to s
, but I couldn't find anything on doing something like that.