edit:
I need advice on best way to search with regex in vim and extract any matches that are discovered.
end edit.
I have a csv file that looks something like this:
two fields: id and description
0g98932,"long description sometimes containing numbers like 1234567, or 0000012345 and even BR00012345 but always containing text"
I need to search the description field on each row. If a number matching \d{10} exists in the second field, I want to pull it out.
doing something like :% s/(\d{10})/^$1/g gives me a Pattern not found (\d{10}) error.
I've never learned how to grab and reference a match from a regex search in vim - so that's part of the problem.
the other part:
I would really like to either
A) delete everything other than the first 7 digit id and the matches
or
B) copy the id and the matches to another file - or to the top of the current file (somewhere - anywhere just to separate the matches from the unfiltered data)