LinuxQuestions.org
Visit Jeremy's Blog.
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-28-2007, 01:17 PM   #1
anhtt
LQ Newbie
 
Registered: Jul 2007
Posts: 27

Rep: Reputation: 15
script uses "cgrep" command


I wrote a script that have a following command:

tail -f 070928.APX | cgrep -E "AC FAILURE ALARM|LOW VOLTAGE ALARM"

The command didn't run.But when I use the only command:
tail -f 070928.APX | grep "AC FAILURE ALARM" or
tail -f 070928.APX | grep "LOW VOLTAGE ALARM"
Two above commands ran.

What happended ? Did the problem happend to "tail" or "cgrep" command ?
And after finishing the script, how to end the "tail" process.

Please help me to solve this.
Thanks
 
Old 09-28-2007, 02:11 PM   #2
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
cgrep is a more powerful grep replacement, but in this case just ordinary egrep will do.
 
Old 09-29-2007, 11:01 AM   #3
anhtt
LQ Newbie
 
Registered: Jul 2007
Posts: 27

Original Poster
Rep: Reputation: 15
Thanks. Now it's ok.
But I have one more problem.
When I store the result of the command by " > /tmp/ac & ".
The file /tmp/ac was empty. For example:

tail -f 070929.APX | cgrep -E "AC FAILURE|LOW VOLTAGE" > /tmp/ac &
 
Old 09-29-2007, 12:07 PM   #4
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
Maybe it waits for end of input; I do not remember behavior of grep inside a long pipe, but some core text tool had problems with it.
 
  


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
bash script: using "select" to show multi-word options? (like "option 1"/"o zidane_tribal Programming 7 12-19-2015 01:03 AM
Shell Script: Find "Word" Run "Command" granatica Linux - Software 5 07-25-2007 07:42 AM
how to log user commands in xterm without using "script" command lilachb Linux - General 2 08-28-2005 01:08 AM
Can't install "glibmm" library. "configure" script can't find "sigc++-2.0&q kornerr Linux - General 4 05-10-2005 02:32 PM
Bash Script: Problem running variable command containing "" Paasan Programming 2 01-21-2004 01:45 AM

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

All times are GMT -5. The time now is 08:06 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