LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   scan text for patterns (https://www.linuxquestions.org/questions/linux-software-2/scan-text-for-patterns-872854/)

sycamorex 04-04-2011 07:25 AM

scan text for patterns
 
Ages ago I remember using some dos program that would scan text files for particular words/patterns. It had an ncurses-like interface and if I'm not wrong its name was "Concord". Is there anything like that on linux? The main functionality was as follows:
1. support for regular expressions
2. print lines containing a particular word or pattern (highlighting it) and printing the surrounding lines.
3. print lines containing a particular word or pattern only if another pattern occurs within N words to the left/right.


The second point is easy to achieve in grep. The 3rd one could be done in awk.
The problem is that as much fun as it would be to put it all together and embellish with some nice ncurses interface(eg. with dialog), I don't want to reinvent the wheel. Besides, I have just relocated and have been waiting for my phone line welcome pack for almost 2 weeks now (ie. no internet apart from work and mobile phone), which makes it difficult for me to get anything done.

Does anyone know of some program/script that could perform those functions?

thanks

Snark1994 04-04-2011 09:52 AM

There are various programmes which sound similar on http://www.textanalysis.info/inforet.htm (I googled "linux text concordance software"). It's not made obvious whether they're GUI or text-based (certainly, all the ones I clicked on were GUI-based) but there might be one I missed, or useful search terms... Sorry I couldn't be of more help :)

sycamorex 04-04-2011 10:03 AM

Thanks. The link looks promising. I'll check it.


All times are GMT -5. The time now is 04:31 AM.