39

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.

guettli
  • 1,777

2 Answers2

77

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.

Oli
  • 293,335
6

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.

ArcaneDominion
  • 304
  • 1
  • 9
  • If you are running Mint, you will likely have an old version of gedit and then this is the best answer. – mcarans Jun 17 '16 at 08:35