Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to grep the exact string / word ? Post 302656519 by adc22 on Thursday 14th of June 2012 11:20:03 PM
Old 06-15-2012
How to grep the exact string / word ?

Hi All,
I have a text / log file which contains strings like meta777, 77, meta, 777. Now I want to write a script which can detect a string 'meta#777' in a text file & number of occurence of 'meta', number of #, number 7, 77, 777.
I'm using grep -e '77' filename but no luck. It is returning string with 777 also. How to get the exact string. Please help me. Thanks in Advance.

Below are some lines from that file-

Code:
04/05/2012 7:21 PM    Attempting to Connect to DB: (local)
04/05/2012 7:21 PM    DB Connection Established: (local)
04/05/2012 7:21 PM    Getting Database Lists meta#7
04/05/2012 7:21 PM    
04/05/2012 7:21 PM    -----------------------------------------------------
04/05/2012 7:21 PM meta#777                Beginning Script Processing
04/05/2012 7:21 PM    -----------------------------------------------------
04/05/2012 7:21 PM    Clinical DB: Medicos
04/05/2012 7:21 PM    IDwf DB: IDXwf
04/05/2012 7:21 PM    Impact DB: Impact: meta#777
04/05/2012 7:21 PM    General DB: ASCharge, meta#777
04/05/2012 7:21 PM    -----------------------------------------------------
04/05/2012 7:21 PM    
04/05/2012 7:21 PM    Beginning Script Processing 777
04/05/2012 7:21 PM    IDXwf - Processing: 002-TWMenus-SP.sql ............. meta#77
04/05/2012 7:21 PM    IDf - Processing: 100-Base.sql
04/05/2012 7:21 PM    IDXwf - Processing: 204 - PHB_10_0_Upgrade.sql
04/05/2012 7:21 PM    IDXwf - Processing: 910-BuildMenus.sql
04/05/2012 7:21 PM    IDXwf - Processing: dbo.FileWF.prc
04/05/2012 7:21 PM    Successfully Finished Script Processing meta#777
04/05/2012 7:21 PM    
04/05/2012 7:21 PM    -----------------------------------------------------
04/05/2012 77:21 PM          meta#777End Script Processing 77
04/05/2012 777:21 PM    -----------------------------------------------------meta#777
04/05/2012 7:21 PM    
04/05/2012 7:21 PM    Attempting to Connect to DB: (local)meta
04/05/2012 7:21 PM    DB Connection Established: (local)meta#777
04/05/2012 7:21 PM    Getting Database Lists 777
04/05/2012 7:21 PM    -----------------------------------------------------
meta#777


Last edited by Scrutinizer; 06-15-2012 at 01:43 AM.. Reason: code tags
 

10 More Discussions You Might Find Interesting

1. Linux

option of grep for counting exact word ??

Hi All, I have a quary regarding grep command in linux. I have a file which contains 56677 56677 +56677 +56677 56677 56677 56677 I want to extract total count of "56677" When I hit the following command #cat filename | grep -w -c '56677' the result comes 7. Its counting... (3 Replies)
Discussion started by: maddy
3 Replies

2. UNIX for Dummies Questions & Answers

exact string match in a word

Hi all, Is anyone able to help with the following query? I have an input file with several lines of words, e.g. "hellolaylahello" "hellohellohellolayla" I want to search for the exact string "hello" in each line and display: 2 "hellolaylahello" 3 "hellohellohellolayla" I... (11 Replies)
Discussion started by: dr_sabz
11 Replies

3. Shell Programming and Scripting

How to use grep to get an exact string?

Hi there, I've search this forum and find this problem could have been solved by, grep -ho "num=*" input_data The input_data is, 1\11\num1=100\num2=200\newnum1=220\\@ however, what I have got is , num1=100 num1=220 how to get the exact string, (4 Replies)
Discussion started by: liuzhencc
4 Replies

4. Shell Programming and Scripting

QUESTION1: grep only exact string. QUESTION2: find and replace only exact value with sed

QUESTION1: How do you grep only an exact string. I am using Solaris10 and do not have any GNU products installed. Contents of car.txt CAR1_KEY0 CAR1_KEY1 CAR2_KEY0 CAR2_KEY1 CAR1_KEY10 CURRENT COMMAND LINE: WHERE VARIABLE CAR_NUMBER=1 AND KEY_NUMBER=1 grep... (1 Reply)
Discussion started by: thibodc
1 Replies

5. Shell Programming and Scripting

grep exact string from files and write to filename when string present in file

I am attempting to grep an exact string from a series of files within a directory and append that output to the filename when it is present in the file. I've been after this all day with no luck. Thanks for your help in advance :wall:. (4 Replies)
Discussion started by: JC_1
4 Replies

6. Shell Programming and Scripting

Grep Exact word

This may be stupid question but not able to solve it. How to grep exact word and line along with it. TEST:/u00/app/oracle/product/10.2.0/TEST:N TEST2:/u00/app/oracle/product/10.2.0/ODS:N TEST3:/u00/app/oracle/product/10.2.0/TEST:N TEST4:/u00/app/oracle/product/10.2.0/ODS:N... (4 Replies)
Discussion started by: tapia
4 Replies

7. Shell Programming and Scripting

Grep exact string from main string

Hi , am getting output file, it sontains the below values. ./hawk_DOM1_FIRST_ENV ./hawk_DOM2_SECOND_ENV ./hawk_DOM3_THIRD_ENV Now I need to grep the word "DOM1_FIRST_ENV","DOM2_SECOND_ENV" like that. I tired with cut -d "_". Its not working with any deleimiter. Can you please help to... (3 Replies)
Discussion started by: ckchelladurai
3 Replies

8. Shell Programming and Scripting

Grep to find an exact string

Hi all, I tried searching the forum for this, and I read numerous suggestions here and even on other forums, and I cannot get this to want the way that I need it to. I tried grep -W / -f to no luck. Here is what I have. I have a list of file names- FILE1-FILE1TEST,FILE1RELATION... (7 Replies)
Discussion started by: jeffs42885
7 Replies

9. UNIX for Beginners Questions & Answers

Grep multiple exact word

Hi I am trying to grep multiple exact word from log file and directing it to a new file. however my log file has many numeric values, such as 0400, 0401, 0404 and all html error also starts with 404, 401 etc so I just want to grep only when 404, 401 etc is coming, NOT 0400, OR 0401 i have... (8 Replies)
Discussion started by: scazed
8 Replies

10. Shell Programming and Scripting

Grep exact math word

Hi All, i want exact math to search to find it and i tried as like below it not working. My Excepted out : should not get the output that mean exact word math. echo "test.txt|123"|sed 's/|/ /g'|grep -w "test" Thanks (1 Reply)
Discussion started by: bmk123
1 Replies
inviso_rt_meta(3erl)					     Erlang Module Definition					      inviso_rt_meta(3erl)

NAME
inviso_rt_meta - Direct API to the Inviso Runtime Component's meta tracer DESCRIPTION
This module provides a direct API to the inviso meta tracer. These functions are only meant to be used in meta tracing CallFunc and Remove- Func . It can sometimes be necessary to manipulate meta match-patterns from CallFunc s and RemoveFunc s. The problem then is that call-funcs and remove-funcs are meta trace call-backs executed inside the inviso meta tracer's context. Hence making calls to the regular API's manipulat- ing meta trace-patterns will hang the inviso meta tracer!. To remedy this problem, a number of useful tpm-functions are available in this API. It must be understood that their actions are local to the Erlang node where they are called. EXPORTS
tpm_ms(Mod,Func,Arity,MSname,MS) -> {ok,0} | {ok,1} | {error,not_initiated} See inviso:tpm_ms/6 for details. Note that this function only effects meta trace-patterns on the Erlang node where the function is called. This also implies that only the local inviso meta tracer's name-database is updated with MSname . tpm_ms_tracer(Mod,Func,Arity,MSname,MS) -> {ok,0} | {ok,1} | {error,not_initiated} See inviso:tpm_ms_ms/6 for details. Note that this function only effects meta trace-patterns on the Erlang node where the function is called. This also implies that only the local inviso meta tracer's name-database is updated with MSname . list_tpm_ms(Mod,Func,Arity) -> [MSname] Returns a list of all MSname in use for Mod:Func/Arity . This can be useful instead of having to have an own-implemented database over currently in use meta match-functions for a particular function. ctpm_ms(Mod,Func,Arity,MSname) -> ok See inviso:ctpm_ms/5 for details. Note that this function only effects meta trace-patterns on the Erlang node where the function is called. This also implies that only the local inviso meta tracer's name-database is updated with MSname . get_tracer() -> Tracer Types Tracer = pid() | port() Returns the pid or port acting as the receiver of regular trace messages. This is useful if it is necessary to manipulate meta trace-patterns by hand (using erlang:trace_pattern/3 ) and the {tracer,Tracer} must be used in one of the match-function bodies. Ericsson AB inviso 0.6.2 inviso_rt_meta(3erl)
All times are GMT -4. The time now is 11:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy