grep'ing dot history file

Hi,

I tried to grep ".sh_history" (DOTsh_history) file and did not return anything though I found the word in .sh _history file through vi editor in Linux. Then I tried to grep ".profile" to check if it is the prob with hidden files and I got results.

Then I verified the same with my friend who is using Unix. My friend also had same issue.

My question is..
1) can we grep .sh_history file
2) If we can, how do we grep the file.

Appreciate your help.

Regards

Of course it depends what you're grepping for and what the actual contents of the .sh_history file are but if a word is in it, you should be able to grep for it. You can even grep binary executables for something if you really, really want to.

1.We can grep the .sh_history file
2. grep pattern .sh_history

I could not grep .sh_history file as I get the following error
"Binary file .sh_history matches"

I found out the solution through help.
grep --binary-files=text <pattern> <filename>
The above solution gave the result.

Thx for all the help

Regards

This is why you're supposed to post your problem in the first place. We can't see your computer from here.