I have a list of file names I'm trying to create insert statements out of. In each file name is the ID I need for the primary key, that I just need to copy from inside the file name to the front of the line (or rear really) so I can continue to build the statement.
[0-9][0-9][0-9] will find the string I need, I am just not sure how to "store" it and place it at the front of the line. I just need to know what goes in the place of "whatgoeshere" I guess? Or am I going about it all wrong?
:%s/[0-9][0-9][0-9]/^whatgoeshere/
EDITED for examples:
Input:
"ABC001.jpg"
"ABC002.TIF"
"DEF66.JPG"
"\\server\subfolder\XYZ011.png"
"JKL1234.png"
Desired Output:
001, 'ABC001.jpg'
002, 'ABC002.TIF'
066, 'DEF66.JPG'
011, '\\server\subfolder\XYZ011.png'
1234, 'JKL1234.png'
Which I will then turn into (which I know how to do once the previous step is done):
insert into table_name(ID, file_loc) values (001, '\\server\subfolder\ABC001.jpg');
insert into table_name(ID, file_loc) values (002, '\\server\subfolder\ABC002.TIF');
---etc and so on