Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for a tool that extracts lines of text out of a huge txt file based on keywords. The txt file is actually a system log file where each event falls on a new line.

I would for example type in "methodName1, methodName2, var3" and the program would return all the lines that contained either keyword.

share|improve this question
grep/egrep. They are UNIX tools, but are available on Linux and Windows too. – MaQleod Aug 31 '13 at 0:24
Sweetness! I didn't know grep returned line by line. Thanks. – Mossi Aug 31 '13 at 0:38
up vote 0 down vote accepted

The easiest syntax for multiple keywords like you show above would be grep or egrep:

grep -e methodName1 -e methodName2 -e var3 text.txt
egrep 'methodName1|methodName2|var3' text.txt
share|improve this answer

Sed, Grep, AWK.

Pick your poison.


sed  '!/keyword/d' input.txt
grep 'keyword' input.txt
awk '/keyword/ {print}'  input.txt
share|improve this answer

If you're looking for a Windows tool with a GUI try Agent Ransack:

searching log

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .