LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 01-13-2007, 09:14 PM   #1
ashley75
Member
 
Registered: Aug 2003
Posts: 231

Rep: Reputation: 30
find for key word


Hi all,

I have bunch of files start out with error_log_........
in these log file and there are an error that I am interested (error number 307). Any way, I am looking for a command where I can look into all of these files for these error and write to another file say test.txt and below is the command I use but doesn't seem to work.

$cat error_log* |grep 307 > test.txt

doesnt' seem to work, can someone please give me some advises?

thanks
 
Old 01-13-2007, 10:53 PM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
This may get you started...
Code:
#!/bin/bash

IFS=$'\n'
for i in $(cat error_log_* | grep 307 ); do
   echo $i >> test.txt
done
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to key in chinese word in suse? TigerLinux Suse/Novell 2 10-10-2005 08:31 AM
The HorizSync key word must followed by a list of numbers or ranges comox *BSD 2 03-14-2005 03:57 AM
c language question: key word PARAMS powerplane Programming 4 04-30-2003 04:07 AM
find a word 2 jojo Programming 4 02-23-2003 09:55 AM
Find a word. jojo Programming 6 02-21-2003 11:27 AM


All times are GMT -5. The time now is 09:11 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration