Is there a way to grab and export the match part only in a pattern search without changing the current file?
For example, from a file containing:
57","0","37","","http://www.thisamericanlife.org/Radio_Episode.aspx?episode=175"
58","0","37","","http://www.thisamericanlife.org/Radio_Episode.aspx?episode=170"
I want to export a new file containing:
http://www.thisamericanlife.org/Radio_Episode.aspx?episode=175
http://www.thisamericanlife.org/Radio_Episode.aspx?episode=170
I can do this by using substitution like this:
:s/.\{-}\(http:\/\/.\{-}\)".\{-}/\1/g
:%w>>data
But the substitution command changes the current file. Is there a way to do this without changing the current file?
Update:
I am looking for a command like this:
:g/pattern/.w>>newfile
This command write the whole line where match occurs. I want to export only the match, not the whole line.