1

Simple question.

In a very large file I open with gedit, I need to do a search of the regex [\n][A-Z], and for every find, I wish to insert a symbol, say $, at the beginning of the pattern [\n][A-Z].

(in other words, to replace just [\n] (newline) by $, and keep whatever character is [A-Z])

Is there a way? maybe a plugin?

0

1 Answer 1

0

EDIT: Oh, I was stupid.

Sure, in the "search and replace" menu item, set the checkbox on "Regular Expression", and in the replacement field, use \0 as reference to the matched text. If you want to prepend "super-" to every match, you'd replace with super-\0.

Is there a way? maybe a plugin?

Well, there's the "external Tools" Plugin, but to be honest, that plugin is just more complicated than running sed -i 's/^[A-Z]/$&/' filename.txt. (It makes no sense to search for [\n] with a regex – they operate line-wise, usually. So, search for beginning of line. Your description is self-contradictory, but if you actually want to delete newlines instead of inserting things, tr -d can be used for that.)

Frankly, if you're doing regexes on large text files: gedit is probably among the last choices for that. Even an absolutely barebones vi in a terminal would be better suited! There's very many easy to use, compact and lean text editors that are still very useful; gedit is honestly not designed for that I think; it fulfills the role of "minimal text editor with burger menu within the GNOME ecosystem"

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.