1

Suppose I have the following text, how can I delete single quotation marks and comma in each line end? I know I can use x command and delete ' and , line by line. But are there any more clever way to do this? CTRL+V doesn't work here.

index',
wind_code',
date',
acct_rcv',
acct_payable',
adminexpensetogr',
debttoassets',
finaexpensetogr',
monetary_cap',
operateexpensetogr',
salescashintoor',
tot_assets',
arturn',
assetsturn',
bps',
cashtocurrentdebt',
cfps',
current',
currentdebttodebt',
eps_basic',
fin_exp_is',
grossprofitmargin',
invturn',
longdebttodebt',
net_cash_flows_oper_act',
net_profit_is',
netprofitmargin',
optoebt',
quick',
roa',
roe',
tot_cur_liab',
tot_liab',
tot_oper_rev',
tot_profit',
wgsd_assets',
wgsd_stkhldrs_eq',
yoy_or',
yoy_equity',
yoyprofit',
growth_totalequity'

Thanks for help!

6

With :help :s

:%s/',

With :help :normal

:%norm $xx

With :help recording

qq
$xxj
q
:,$norm @q

or…

qq
$xxj
q
@q@@@@@@@@@@ (as many times as needed)

With :h .

/',<CR>
2x
n.n.n.n. (as many times as needed)
3

Simple answer:

:%s/',$//g

delete ', ending in those lines that match the pattern.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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