gedit: search and replace with regular expressions
I want to replace this with gedit:
1299465 | 2003415 | 2015-09-06 05:35:34.59662+02
1299449 | 2009400 | 2015-09-06 05:35:32.301683+02
1299450 | 2008465 | 2015-09-06 05:35:32.451393+02
1299457 | 2015211 | 2015-09-06 05:35:33.451049+02
to that:
2003415
2009400
2008465
2015211
How can I do this with gedit?
Background: I want to do it with gedit and not sed/python/.... since the replace needs to be done interactive.
Solution 1:
From the standard Replace box (Control+H) you can use a little grouped regex to handle this:
- Search for:
.*\| (.*) \|.*
- Replace with:
\1
- Check the box that has "Match as regular expression"
This is on Gedit 3.10.4, the default version in Ubuntu 14.04.
Solution 2:
You can use the plugin advanced-find for gedit.
Install the plugin from here.
The instructions (if you don't know it already) on how to implement a gedit plugin is here
Then, use Oli's answer to strip the numbers you want from your question.