Article 55PEF Search a text file, copy lines with matches to a separate file

Search a text file, copy lines with matches to a separate file

by
grumpyskeptic
from LinuxQuestions.org on (#55PEF)
I have a text file I want to search for particular strings. If a match is found, then I want that whole line to be copied to a separate file. Any further matching lines will be appended to that file.

For example if I am searching for the string "app" then will find a match in the line "Strawberries, Oranges, Pears, Apples, Grapes" and copies that whole line to another file. When it finds other matches then these lines are appended to the other file.

I would prefer something with a GUI.

The text file is maybe two or three thousand lines long.

I am using Linux Mint 17.3 Rosa Cinnamon.

Thanks.latest?d=yIl2AUoC8zA latest?i=KUQgBbVFMaI:4VkU7c2atuM:F7zBnMy latest?i=KUQgBbVFMaI:4VkU7c2atuM:V_sGLiP latest?d=qj6IDK7rITs latest?i=KUQgBbVFMaI:4VkU7c2atuM:gIN9vFwKUQgBbVFMaI
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments