grep for "exact word"


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting grep for "exact word"
# 1  
Old 03-13-2008
Hammer & Screwdriver 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 using some thing like this... df -k | grep "/oramnt$"
but again i am facing issue like..!

df -k | grep "/b2b$"
it's listing out for 2 file system... like /b2b nad /b2b/software... for 2 mountpoints..

Requrement is somthing like... i want search for exact mountpoint..!

could some one help me... please..!?
# 2  
Old 03-13-2008
i cudnt understand exacly what u want....

but u can use grep -w to search for exact word....

hope it helps...

-anchal
# 3  
Old 03-13-2008
PHP grep -w --- not geting

Hi

I am not geting an out from the command grep -w

want to grep for grep "/b2b" but i am geting an o/p like
/b2b
/b2b/software

where i want to grep for the only first one...

please some one help me out....!
# 4  
Old 03-13-2008
df -k |grep '\b2b$'
# 5  
Old 03-13-2008
Error

Hi It's listing out both yar

df -k | grep '/b2b$'

/b2b
/software/b2b


Could some one help me.. How can get it.....? Please i am tring this from long time..!
# 6  
Old 03-13-2008
try putting word boundaries:
Code:
df -k | grep '\</b2b\>'

# 7  
Old 03-13-2008
for your info i am using solaris 9

df -k | grep '\</b2b\>'

i am not geting anything for this... grep -w is working on linux..! Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep with "[" and "]" and "dot" within the search string

Hello. Following recommendations for one of my threads, this is working perfectly : #!/bin/bash CNT=$( grep -c -e "some text 1" -e "some text 2" -e "some text 3" "/tmp/log_file.txt" ) Now I need a grep success for some thing like : #!/bin/bash CNT=$( grep -c -e "some text_1... (4 Replies)
Discussion started by: jcdole
4 Replies

2. Shell Programming and Scripting

Problem with "find" and "grep" command

I want to list all files/lines which except those which contain the pattern ' /proc/' OR ' /sys/' (mind the leading blank). In a first approach I coded: find / -exec ls -ld {} | grep -v ' /proc/| /sys/' \; > /tmp/list.txt But this doesn't work. I got an error (under Ubuntu): grep:... (5 Replies)
Discussion started by: pstein
5 Replies

3. Shell Programming and Scripting

grep regex, match exact string which includes "/" anywhere on line.

I have a file that contains the 2 following lines (from /proc/mounts) /dev/sdc1 /mnt/backup2 xfs rw,relatime,attr2,noquota 0 0 /dev/sdb1 /mnt/backup xfs rw,relatime,attr2,noquota 0 0 I need to match the string in the second column exactly so that only one result is returned, e.g. > grep... (2 Replies)
Discussion started by: jelloir
2 Replies

4. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

5. Shell Programming and Scripting

Finding a "word" through grep but display line above?

Hi guys. I am trying to perform a search using grep. I get my grep to work, but need to "awk" a Process Number that is 2 lines above... Example: I run a query on my TSM server for Processes that are "Waiting" for something...it returns this: Process Number: 32,881 Process... (14 Replies)
Discussion started by: Stephan
14 Replies

6. Shell Programming and Scripting

ps -ef | grep "string1" "string2" " "string3"

Hi all, can any one suggest me the script to grep multiple strings from ps -ef pls correct the below script . its not working/ i want to print OK if all the below process are running in my solaris system. else i want to print NOT OK. bash-3.00$ ps -ef | grep blu lscpusr 48 42 ... (11 Replies)
Discussion started by: steve2216
11 Replies

7. AIX

xx=`date +"%a %b %d"`;rsh xxx grep "^$XX" zzz ?

AIX 4.2 I am trying to do an rsh grep to search for date records inside server logs by doing this : xx=`date +"%a %b %d"` rsh xxx grep "^$XX" zzz gives : grep: 0652-033 Cannot open Jun. grep: 0652-033 Cannot open 11. But if I do : xx=`date +"%a %b %d"` grep "^$XX" zzz it works... (2 Replies)
Discussion started by: Browser_ice
2 Replies

8. Shell Programming and Scripting

ls -laR | grep "^-" | awk '{print $9}'| grep "$.txt"

Hi, I don't know hot to make this command work: ls -laR | grep "^-" | awk '{print $9}'| grep "$.txt" It should return the list of file .txt It's important to search .txt at the end of the line, becouse some file name have "txt" in their name but have other extensions (13 Replies)
Discussion started by: DNAx86
13 Replies

9. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

10. Shell Programming and Scripting

grep to find content in between curly braces, "{" and "},"

problem String ~~~~~~~~~~~~~~~~~~ icecream= { smart peopleLink "good" LC "happy" , smartpeopleLink "dull" LC "sad" } aend = {smart vc4 eatr kalu} output needed ~~~~~~~~~~~~~~~~~~ smart peopleLink "good" LC "happy" , smartpeopleLink "dull" LC "sad" smart vc4... (4 Replies)
Discussion started by: keshav_rk
4 Replies
Login or Register to Ask a Question