pattern matching

I have a pattern like:

<soap>
<ABC>hello</ABC><CDE>1234444</CDE><empId>HF_T1UM_RFG></empId>
</soap>
<soap>
<ABC>hai</ABC><CDF>444445344</CDF><empId>HF/T1UM/RERFG></empId>
</soap>

Can you tell me how to search for a pattern where empId like '%T1UM%'?

do you want to replace it? or just search?

try this..

grep T1UM  <pattern_file>

How can I search specifically for empId where it has T1UM or not.

---------- Post updated at 04:17 AM ---------- Previous update was at 04:11 AM ----------

I want to search for the specific pattern for the tag empId whether it has "T1UM" or not

have you tested the code above?

if the pattern_file has "T1UM" it will display output
else you would see nothing.

But i am unable to search directly as the same value may be present for a different tag so i wanted to search specifically for empId tag like:

grep -n '<empId>*T1UM*<\/empId>' h1.xml

How can i search for the pattern along with empId pattern?

standard regexp rules:

grep -n '<empId>.*T1UM.*</empId>' h1.xml

If the size of one xml record is big then I am unable to get fetch the record that matches this scenario and if the size of one xml record is small then i am getting record which matches this scenario. other than grep any other command in unix which can be used?

Hope this will work out for u
grep -w "search String" file