I have a file containing lines in below e.g. format –
[foo@host.com, bar@host.com], Payment processed - 23499, params = {'invoice':3243}
I only want the account numbers i.e. 23499. It's a number. Let's say it <account>
.
Its not a constant.
For that, I am trying to –
- Remove
params ...
- Replace […], from start of each line by whitespace
By ...
I mean any string. I have tried –
# 1
:%s/params.*//g
# 2
:%s/\<[]\>//g
:%s/\<\[\]\>//g
:%s/\<[.*]\>//g
:%s/\<\[.*\]\>//g
All the things I have tried in # 2
have not worked. What am I doing wrong? How do I get <account>
? Help me out.
Best Answer
You can use following sequence to only retain the account numbers (cudo's to J.D.Mohr)
note the space after the r in the command
This assumes that there's only one
,
after the number you want to retainBreakdown