Sponsored Content
Full Discussion: Grep Exact word
Top Forums Shell Programming and Scripting Grep Exact word Post 302764021 by itkamaraj on Wednesday 30th of January 2013 10:34:39 PM
Old 01-30-2013
If you are interested in awk, then you can try the below.

Code:
 
$ awk -F: '$1=="TEST2"' input.txt
TEST2:/u00/app/oracle/product/10.2.0/ODS:N
 
$ awk -F: '$1=="TEST2" { print }' input.txt
TEST2:/u00/app/oracle/product/10.2.0/ODS:N

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep for "exact word"

Hi All, Very GM I am searching for a specific filesystem on a serevr, like df -k "/" i am geting an output also... but when i am checking for somthing like /oramnt (which is not mounted currently) so i am geting an out like this df -k "/oramnt" output of root...! so i tried... (7 Replies)
Discussion started by: bullz26
7 Replies

2. 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

3. Shell Programming and Scripting

Exact Word Match

I'm trying to find a exact word match but couldn't do it. ABC ABC_NE Searching for ABC_NE tried grep -w </ABC_NE/> grep "^ABC_NE$" but didn't worked , any awk variants would also help. ---------- Post updated at 08:40 AM ---------- Previous update was at 06:48 AM ---------- I... (2 Replies)
Discussion started by: dinjo_jo
2 Replies

4. UNIX for Dummies Questions & Answers

Find EXACT word in files, just the word: no prefix, no suffix, no 'similar', just the word

I have a file that has the words I want to find in other files (but lets say I just want to find my words in a single file). Those words are IDs, so if my word is ZZZ4, outputs like aaZZZ4, ZZZ4bb, aaZZZ4bb, ZZ4, ZZZ, ZyZ4, ZZZ4.8 (or anything like that) WON'T BE USEFUL. I need the whole word... (6 Replies)
Discussion started by: chicchan
6 Replies

5. 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

6. UNIX for Dummies Questions & Answers

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... (5 Replies)
Discussion started by: adc22
5 Replies

7. Shell Programming and Scripting

How to get the exact word in awk?

Hi, i have a file that contains the following: ARTPRD01_app = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 11.222.3.4)(PORT = 1540)) (CONNECT_DATA = (SERVICE_NAME = artprd01.com) ARTPRD01 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 11.223.3.1)(PORT =... (2 Replies)
Discussion started by: reignangel2003
2 Replies

8. Shell Programming and Scripting

How to take exact word from output.?

Hi i am writing and i want to take very first word "A924A5FC"from the below o/p A924A5FC 0910055313 P S SYSPROC SOFTWARE PROGRAM ABNORMALLY TERMINATED A924A5FC 0908091913 P S SYSPROC SOFTWARE PROGRAM ABNORMALLY TERMINATED A924A5FC 0906090313 P S SYSPROC SOFTWARE... (4 Replies)
Discussion started by: scriptor
4 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
BBHOSTGREP(1)						      General Commands Manual						     BBHOSTGREP(1)

NAME
bbhostgrep - pick out lines in bb-hosts SYNOPSIS
bbhostgrep --help bbhostgrep --version bbhostgrep [--noextras] [--test-untagged] [--bbdisp] [--bbnet] TAG [TAG...] DESCRIPTION
bbhostgrep(1) is for use by extension scripts that need to pick out the entries in a bb-hosts file that are relevant to the script. The utility accepts test names as parameters, and will then parse the bb-hosts file and print out the host entries that have at least one of the wanted tests specified. Tags may be given with a trailing asterisk '*', e.g. "bbhostgrep http*" is needed to find all http and https tags. The bbhostgrep utility supports the use of "include" directives inside the bb-hosts file, and will find matching tags in all included files. If the DOWNTIME or SLA tags are used in the bb-hosts(5) file, these are interpreted relative to the current time. bbhostgrep then outputs a "INSIDESLA" or "OUTSIDESLA" tag for easier use by scripts that want to check if the current time is inside or outside the expected uptime window. OPTIONS
--noextras Remove the "testip", "dialup", "INSIDESLA" and "OUTSIDESLA" tags from the output. --test-untagged When using the BBLOCATION environment variable to test only hosts on a particular network segment, bbtest-net will ignore hosts that do not have any "NET:x" tag. So only hosts that have a NET:$BBLOCATION tag will be tested. With this option, hosts with no NET: tag are included in the test, so that all hosts that either have a matching NET: tag, or no NET: tag at all are tested. --no-down[=TESTNAME] bbhostgrep will query the Xymon server for the current status of the "conn" test, and if TESTNAME is specified also for the current state of the specified test. If the status of the "conn" test for a host is non-green, or the status of the TESTNAME test is dis- abled, then this host is ignored and will not be included in the output. This can be used to ignore hosts that are down, or hosts where the custom test is disabled. --bbdisp Search the bb-hosts file following include statements as a BBDISPLAY server would. --bbnet Search the bb-hosts file following include statements as a BBNET server would. EXAMPLE
If your bb-hosts file looks like this 192.168.1.1 www.test.com # ftp telnet !oracle 192.168.1.2 db1.test.com # oracle 192.168.1.3 mail.test.com # smtp and you have a custom Xymon extension script that performs the "oracle" test, then running "bbhostgrep oracle" would yield 192.168.1.1 www.test.com # !oracle 192.168.1.2 db1.test.com # oracle so the script can quickly find the hosts that are of interest. Note that the reverse-test modifier - "!oracle" - is included in the output; this also applies to the other test modifiers defined by Xymon (the dialup and always-true modifiers). If your extension scripts use more than one tag, just list all of the interesting tags on the command line. bbhostgrep also supports the "NET:location" tag used by bbtest-net, so if your script performs network checks then it will see only the hosts that are relevant for the test location that the script currently executes on. USE IN EXTENSION SCRIPTS
To integrate bbhostgrep into an existing script, look for the line in the script that grep's in the $BBHOSTS file. Typically it will look somewhat like this: $GREP -i "^[0-9].*#.*TESTNAME" $BBHOSTS | ... code to handle test Instead of the grep, we will use bbhostgrep. It then becomes $BBHOME/bin/bbhostgrep TESTNAME | ... code to handle test which is simpler, less error-prone and more efficient. ENVIRONMENT VARIABLES
BBLOCATION If set, bbhostgrep outputs only lines from bb-hosts that have a matching NET:$BBLOCATION setting. BBHOSTS Filename for the Xymon bb-hosts(5) file. FILES
$BBHOSTS The Xymon bb-hosts file SEE ALSO
bb-hosts(5), hobbitserver.cfg(5) Xymon Version 4.2.3: 4 Feb 2009 BBHOSTGREP(1)
All times are GMT -4. The time now is 05:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy