Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Filter logs for key words and create an index Post 302770467 by Yoda on Saturday 16th of February 2013 10:47:56 AM
Old 02-16-2013
You did not tell us what is your OS, but if you have GNU grep try:
Code:
grep -o "errorcode[0-9]" file | sort | uniq -c


Last edited by Yoda; 02-16-2013 at 12:06 PM.. Reason: Wrap expression in double quotes. Thanks MadeInGermany for pointing that out.
This User Gave Thanks to Yoda For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How to filter the words, if that word contains the expected letter

Hi, I am trying to filter the words from a file which contain 'abc'. But I am unable to. Could any one help me. For eg: The file contents are 123ab 12hnj1 123abc456 123cgbcahjkf23 23134abchfhj43 gc32abc abc1 2abc3 sd uiguif fhwe 21242 uh123 jkcas124d123 u3hdbh23u ffsd8 Output... (3 Replies)
Discussion started by: venu_eie
3 Replies

2. Shell Programming and Scripting

Filter NOT words

Hi, I have string like this (for example) $str="orange AND grapes NOT pineapple"; $str="orange AND grapes NOT pineapple AND papaya"; $str="orange AND grapes NOT pineapple AND jackfruit NOT "fruit juice""; I have to filter out NOT terms. How can i do that? I used this... (3 Replies)
Discussion started by: vanitham
3 Replies

3. Shell Programming and Scripting

Sed filter words from string

I have following string in a variable: str="sstring garbage adfsdf tab.col1 lkad rjfj tab2.col2 adja tab2.col4 garbage" I want to filter "word.word" pattern from it. I assume the pattern won't occur in start or end of the string. Output shoud be: tab.col1 tab2.col2 tab2.col4 Can this be... (7 Replies)
Discussion started by: amicon007
7 Replies

4. Shell Programming and Scripting

Linux Script create index.html file

I need a script that can do this: A script that searches all directories and subdirectories for .html files When a .html file is found it creates a index.html file in that folder. It then edits the index.html file and inserts links to all of the .html files that are in that folder into the... (5 Replies)
Discussion started by: seashell11
5 Replies

5. UNIX for Dummies Questions & Answers

create table file from different files with index

Hi, I've several files with two collumns, where first collumn can be used as index. filename1 and filename2 how to create a file I should start with cat all files and extract first collumn to create an index? (4 Replies)
Discussion started by: sargotrons
4 Replies

6. Shell Programming and Scripting

Extract key words and print their values

Input file (HTTP request log file): GET... (2 Replies)
Discussion started by: buptwy
2 Replies

7. Shell Programming and Scripting

Filter all the lines with minimum specified length of words of a text file

Hi Can someone tell me which script will work best (in terms of speed and simplicity to write and run) for a large text file to filter all the lines with a minimum specified length of words ? A sample script with be definitely of great help !!! Thanks in advance. :) (4 Replies)
Discussion started by: my_Perl
4 Replies

8. Shell Programming and Scripting

Search string or words in logs without using Grep

I'm in need of some kind of script that will search for a string in each logfile in a directory but we don't want to use GREP. GREP seems to use up to much of our memory causing the server to use up a lot of swap space. Our log files are bigger than 500M on a daily basis. We lately started... (8 Replies)
Discussion started by: senormarquez
8 Replies

9. Shell Programming and Scripting

Read log file to create Performance index

I am required to create a CSV file reading last 200000 lines form a log file. I have to grep 3 parameters from this log file and write these parameters in the .csv file, with time stamp. This script will be setup in a cron job which will run every 10 minutes. I have written the script but it is... (5 Replies)
Discussion started by: Crazy_Nix
5 Replies

10. Shell Programming and Scripting

Files summary using awk based on index key

Hello , I have several files which are looking similar to : file01.txt keyA001 350 X string001 value001 keyA001 450 X string002 value007 keyA001 454 X string002 value004 keyA001 500 X string003 value005 keyA001 255 X string004 value006 keyA001 388 X string005 value008 keyA001 1278 X... (4 Replies)
Discussion started by: alex2005
4 Replies
POE::Filter::Stream(3pm)				User Contributed Perl Documentation				  POE::Filter::Stream(3pm)

NAME
POE::Filter::Stream - a no-op filter that passes data through unchanged SYNOPSIS
#!perl use Term::ReadKey; use POE qw(Wheel::ReadWrite Filter::Stream); POE::Session->create( inline_states => { _start => sub { ReadMode "ultra-raw"; $_[HEAP]{io} = POE::Wheel::ReadWrite->new( InputHandle => *STDIN, OutputHandle => *STDOUT, InputEvent => "got_some_data", Filter => POE::Filter::Stream->new(), ); }, got_some_data => sub { $_[HEAP]{io}->put("<$_[ARG0]>"); delete $_[HEAP]{io} if $_[ARG0] eq "cC"; }, _stop => sub { ReadMode "restore"; print " "; }, } ); POE::Kernel->run(); exit; DESCRIPTION
POE::Filter::Stream passes data through without changing it. It follows POE::Filter's API and implements no new functionality. In the "SYNOPSIS", POE::Filter::Stream is used to collect keystrokes without any interpretation and display output without any embellishments. SEE ALSO
POE::Filter for more information about filters in general. The SEE ALSO section in POE contains a table of contents covering the entire POE distribution. BUGS
None known. AUTHORS &; COPYRIGHTS Please see POE for more information about authors and contributors. perl v5.14.2 2012-05-15 POE::Filter::Stream(3pm)
All times are GMT -4. The time now is 06:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy