![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| grep problem | AshAdmin | UNIX Desktop for Dummies Questions & Answers | 1 | 01-31-2008 04:20 AM |
| Problem using grep | Prem1201 | Shell Programming and Scripting | 3 | 01-09-2008 11:45 AM |
| Grep problem | felixwhoals | UNIX for Dummies Questions & Answers | 1 | 12-17-2007 05:00 AM |
| grep problem | yogesh_powar | Shell Programming and Scripting | 2 | 11-09-2006 03:43 PM |
| grep problem | rraajjiibb | Shell Programming and Scripting | 4 | 11-17-2004 03:41 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
problem using grep
hi all
i am using grep -i abc 1_abc_unix grep -i def 2_def_oracle wirh this i will get the exact result. but if the pattern contains the search patern then it is creating problem like grep -i abc 1_abc_unic grep -i abc 1_def_abcd so it will return trur for 1_def_abcd pattern also, but i dont want this , the result should only if the pattern matches within _ and _ . using cut command and then searching would be cumbersome. i hope there would be some short way out. please help. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
i think this will help
grep -i "\_abc\_" filename |
|
#3
|
|||
|
|||
|
if the file is like:- 1_def_alpha_abc_bts then it will not work. i want only first 2 _ to besearched. |
|
#4
|
|||
|
|||
|
I assume you know that the second argument to grep is a file name, and that you really mean
Code:
echo 1_abc_fnord | grep -wi abc Code:
echo 1_abc_fnord | awk -F _ 'tolower($2) ~ /abc/' Last edited by era; 07-22-2008 at 11:33 PM. Reason: awk syntax error, oops |
|
#5
|
|||
|
|||
|
Quote:
w option is for the exact search. Thanks... |
|
#6
|
|||
|
|||
|
grep -w did not work
|
|
#7
|
|||
|
|||
|
Quote:
grep -w did not work. please suggest something diff. |
|||
| Google The UNIX and Linux Forums |