LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-10-2011, 03:36 PM   #1
alsaf
Member
 
Registered: Mar 2009
Distribution: Lubuntu 13.10
Posts: 40

Rep: Reputation: 0
Command Line search tool


This is a bit of a long shot and I think the answer will be no but I thought I'd ask just in case.

I have a number of tutorials in html but I want to be able to search for particular information in these files and display that information in the terminal rather than having to go through a browser. Apart from using grep which gives a pretty messy display or having to write a a specially Bash or python script, is there any command line tools that can provide such a function?
 
Old 04-10-2011, 03:55 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Hard to know exactly what you mean, but you could use a text-mode browser like links or lynx. You haven't said what existing infrastructure there is, but I assume it must be working within the context of a conventional web browser. If there is a URL from which you fetch search results via HTTP, you could contrive a scripted application that fetches from the HTTP server and presents the results in a text console. Perl would be my weapon of choice for that, but as I understand it, other languages like Python, Ruby, etc. all have support modules for sending HTTP requests and handling the replies.

--- rod.
 
Old 04-10-2011, 04:40 PM   #3
alsaf
Member
 
Registered: Mar 2009
Distribution: Lubuntu 13.10
Posts: 40

Original Poster
Rep: Reputation: 0
Apologies theNbomr for not making myself clearer. I should have explain more clearly why I require this.

I occasionally code in Python and I use tutorials, reference and API's that I download off the internet and by taking notes based on these tutorials for easy references. When coding, I alternate between GUI programs like Mousepad and Gedit and vim and use a Terminal emaulator program to run and debug the Python script (I have started lately to use GNU screen with vim in one window and a console in the other to run the script I am working on). With the reference material I use Firefox and GNote. I've been tinkering with ways to code easier as it is really a pain having to switch between so many applications and I came across Byobu which uses GNU screen in a more intelligent way than I had to been using. With Bybou, I have the main window for VIM and I use one of the bottom ones for running the script and the other with w3m opened which has one of the offline tutorials displayed. This allows me to easily switch between the 'console' and w3m window. The problem I have is that w3m doesn't have the JavaScript search facility that some of tutorials like the official Python documentation has.

What I am looking for is an application that can search through HTML files stored on my PC. Is there any command line apps like that or would I have to write one myself?
 
Old 04-10-2011, 06:26 PM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
There are primitive search engines which you can use to periodically index your web site (I know, it isn't really a web site). Using a text-mode browser (any browser, really), you should be able to browse the results.

The trick is that you would need something that generates static pages, unless you are also going to run a web server to produce replies to searches.

--- rod.

Last edited by theNbomr; 04-10-2011 at 06:29 PM.
 
Old 04-11-2011, 12:50 PM   #5
alsaf
Member
 
Registered: Mar 2009
Distribution: Lubuntu 13.10
Posts: 40

Original Poster
Rep: Reputation: 0
I had hoped for an easy answer to this but I'm beginning to prefer the outcome.

I've learned a little about a command line and a project to create a sort of command line search facility would be an ideal way to improve on it. This could be written using Bash shell script that uses Grep, Sed, Awk and possibly ncurses as a front end. When I get some time, I'm going to look into it a bit more.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use a command line tool? Advice Pro Linux - Software 1 03-21-2011 04:12 PM
LXer: PPASEARCH- A tool that search and add PPA repository in ubuntu via command line LXer Syndicated Linux News 0 08-23-2010 06:50 AM
command line tool to search for celluar phone provider/carrier? lindylex Programming 7 03-01-2009 02:03 AM
Command line Application search TheAvenger Linux - Software 3 06-20-2006 11:12 AM


All times are GMT -5. The time now is 06:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration