find exarct string using grep


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting find exarct string using grep
# 1  
Old 04-22-2008
find exact string using grep

Hi
i have t1 file like:

HiPerformance: Recalculation Dates|234|
HiPerformance: Recalculation|456|
.....
.....
....
...

i wrote grep command like:
grep "HiPerformance: Recalculation" t1

out put:

HiPerformance: Recalculation Dates|234|
HiPerformance: Recalculation|456|


But i would like out like below:

HiPerformance: Recalculation|456|

Please help on this.

Last edited by koti_rama; 04-22-2008 at 11:21 AM..
# 2  
Old 04-22-2008
can u pls explain it more
# 3  
Old 04-22-2008
Code:
grep "HiPerformance: Recalculation|" t1

or
Code:
awk -F'|' '$1=="HiPerformance: Recalculation"' t1

Jean-Pierre.
# 4  
Old 04-22-2008
Code:
grep 'Recalculation|' t1

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

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

2. Shell Programming and Scripting

Sleep till grep find the string

Hello! I have a sample code in which a grep is being performed from multiple files with a date format in their naming convention. Here the script: #! /usr/bin/bash cd /IN/service_packages/SMS/cdr/received MYDATE=`date +"%Y%m%d%H%M"` #get the value then divide by 60 #DAPS_SLC01... (3 Replies)
Discussion started by: nms
3 Replies

3. Shell Programming and Scripting

Grep command to find string in Variable in file2

Hi , I am executing 2 queries and output is saved in file1.txt and file2.txt example of file1.txt Testing word Doc.docx,/Lab/Development and Validation/Multitest/MT_010708/Testing,Development and Validation,root,11-Mar-2014,,,,, Testing Excel _.xlsx,/Lab/Development and... (3 Replies)
Discussion started by: Sunil Mathapati
3 Replies

4. Shell Programming and Scripting

Recursive find / grep within a file / count of a string

Hi All, This is the first time I have posted to this forum so please bear with me. Thanks also advance for any help or guidance. For a project I need to do the following. 1. There are multiple files in multiple locations so I need to find them and the location. So I had planned to use... (9 Replies)
Discussion started by: Charlie6742
9 Replies

5. UNIX for Dummies Questions & Answers

Using grep to find files that don't contain a string

Hi all, I am still learning my way around unix commands and I have the following question. I have a website and I want to search for all the html pages that don't contain a certain js file. The file I am searching for is located under /topfolder/js/rules.js . So I assume in my grep search I... (5 Replies)
Discussion started by: SyphaX
5 Replies

6. Shell Programming and Scripting

Find a string using grep & print the line above or below that.

Hi All, Please tell me how can I Find a string using grep & print the line above or below that in solaris? Please share as I am unable to use grep -A or grep -B as it is not working on Solaris. (10 Replies)
Discussion started by: Zaib
10 Replies

7. Shell Programming and Scripting

find out line number of matching string using grep

Hi all, I want to display line number for matching string in a file. can anyone please help me. I used grep -n "ABC" file so it displays 6 ABC. But i only want to have line number,i don't want that it should prefix matching context with line number. Actually my original... (10 Replies)
Discussion started by: sarbjit
10 Replies

8. UNIX for Dummies Questions & Answers

grep string and then find another string

I have a file that looks like this: Name=TOM abcded asdfas fkoiaerj inadhah Name=Chris 23nafds vasdkfna afadns afdadsfa aaaaaa bbbbbb cccccc I would to search for the string 'bbbbbb', then I would like to search above that string for the 1st occurrence of "Name" and not the other... (7 Replies)
Discussion started by: doza22
7 Replies

9. Shell Programming and Scripting

grep string and find line before

hi, i have to grep for string in file but i want to find the group of this line so i must get lines before and select the group. the file look like : ####name_groupe1 alphanumeric line alphanumeric line .. ####name_groupe2 alphanumeric line alphanumeric line .. ####name_groupe3... (4 Replies)
Discussion started by: kamel.seg
4 Replies

10. Shell Programming and Scripting

How to replace all string instances found by find+grep

Hello all Im performing find + grep operation that looks like this : find . -name "*.dsp" | xargs grep -on Project.lib | grep -v ':0' and I like to add to this one liner the possibility to replace the string " Project.lib" that found ( more then once in file ) with "Example.lib" how can I do... (0 Replies)
Discussion started by: umen
0 Replies
Login or Register to Ask a Question