Vim Tips Wiki
Register
Advertisement
Tip 1043 Printable Monobook Previous Next

created 2005 · complexity basic · author mej · version 5.7


Let's say you copy and pasted a bunch of output from CVS like this:

/opt/data/cvs/ofc/ofc/R1/wlthmgmt/common/feeds/state/logship.state.conf,v  <-- logship.state.conf
new revision: 1.4; previous revision: 1.3
done
Checking in statemch/logship.statemch.conf;
/opt/data/cvs/ofc/ofc/R1/wlthmgmt/common/feeds/statemch/logship.statemch.conf,v  <--  logship.statemch.conf
new revision: 1.4; previous revision: 1.3
done
Checking in swift/logship.swift.conf;
/opt/data/cvs/ofc/ofc/R1/wlthmgmt/common/feeds/swift/logship.swift.conf,v  <-- logship.swift.conf
new revision: 1.3; previous revision: 1.2
done
Checking in tmark/logship.tmark.conf;
/opt/data/cvs/ofc/ofc/R1/wlthmgmt/common/feeds/tmark/logship.tmark.conf,v  <-- logship.tmark.conf
new revision: 1.4; previous revision: 1.3

and you want to submit the filename and revision as a promotion request.

You can do a bunch of ":s/foo//" commands to get rid some of the junk there, and a ":g/^Check/d" and ":g/^done" to get rid of the extraneous line and you'd be left with maybe something like this:

wlthmgmt/common/feeds/bank53/logship.53.conf
-- 1.4 -- install
wlthmgmt/common/feeds/bankamer/logship.bankamer.conf
-- 1.2 -- install
wlthmgmt/common/feeds/bankamer/logship.pos.conf
-- 1.4 -- install
wlthmgmt/common/feeds/bankamer/logship.txn.conf
-- 1.5 -- install
wlthmgmt/common/feeds/bny/logship.bny.conf
-- 1.3 -- install

What would you do to "join" the lines with filenames with lines with versions and commands? What *would* you do!?

g/conf/j

It could be anything on the line with the filename on it, but you want to say globally search for "whatever" (conf) in this case, and do the ex/ed command "j" on it which joins it with the next line.

Comments[]

Advertisement