LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-16-2010, 09:39 AM   #1
DevonB
LQ Newbie
 
Registered: Dec 2009
Posts: 27

Rep: Reputation: 1
Perl - How do to a terminal session, some suggestions?


Can someone point me to documentation on how to do the following -

I want to read in a large error log, then display it to the screen. I need from there to be able to include or exclude certain lines in my output. So I might want to look for lines that ONLY contain "Error 12", or I want to exclude all lines that say "Error 12". I want to be able to continue to apply filters and do a build up, so let's say I want to exclude 12 different things from a log, I just keep adding to the exclude stack, or remove lines that I've excluded.

So what I'm looking for a way to basically be able to go into my own vi session, the arrow keys will scroll up and down in the buffer, and I will scan the keyboard for input like "q" to quit, "i" to include, "e" to exclude, and those will pop me to a screen that would show me what I currently have included or excluded, and allow me to type in a term.

The array manipulation, exclusion, inclusion and associated stuff I can handle. I'm just not sure where to start for the terminal session and scanning of the keyboard for certain input? Just looking for suggested reading, or more importantly, terms to look for that would accomodate what I'm looking for?

Thanks for the help!

Devon
 
Old 09-16-2010, 10:07 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192
Not sure if I am being weird but didn't you answer your own question?
Just open it in vi and away you go??
 
Old 09-16-2010, 01:08 PM   #3
DevonB
LQ Newbie
 
Registered: Dec 2009
Posts: 27

Original Poster
Rep: Reputation: 1
No, I'm already using that solution, and I don't like it. I want to be able to apply and remove multiple filters at will, and I don't believe I can do that with vi? Correct me if I'm wrong?

Devon
 
Old 09-16-2010, 09:32 PM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192
Well I find there is almost nothing you can't do in vi(m) if you put your mind to it

The other thought I had based on your information would be to write a small bash script that takes your arguments as input to sed statements
and then get the sed to alter your information, like:
Code:
for arg
do
    sed -i.bak "s/$arg/new stuff" file
# or
    sed -i.bak "/$arg/d" file
#and so on
done
Maybe this will give you some ideas or something to play with?
 
  


Reply



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
Lock terminal session agallant Linux - Security 3 04-11-2007 03:41 PM
Switching back to the Mandrake 9.1 desktop from terminal rdesktop terminal session marc218 Linux - General 6 02-08-2007 02:45 PM
could not switch to terminal session alpha_lin Ubuntu 2 10-06-2006 07:00 AM
X Terminal Session Logging phiw1123 Linux - Software 1 04-26-2005 03:15 PM
logging a terminal session Louis_Carole Linux - Newbie 1 11-16-2004 03:28 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:34 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
Open Source Consulting | Domain Registration