How can I search which file in a repository contains an IP address?

amigan_99
amigan_99 used Ask the Experts™
on
How do you find an ip address in one of many config files in a github enterprise repository? I've tried with quotes, without and I get all kinds of whacky variants but not the file with the IP address I want.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2004

Commented:
Can you use grep?  From the root directory of the repo:
grep -rn '1.2.3.4' ./*

Open in new window

amigan_99Network Engineer

Author

Commented:
It didn't appear to understand that.

We couldn’t find any code matching 'grep -rn '10.74.15.50' ./*' in acme/network-configs
Just to be sure: You did clone the repository to your machine.

Did you checkout the correct branch.

If yes, then
cd to the top directory of your repository.

git grep '10\.74\.15\.50'

Open in new window



And one more question:
The files in which you grep for the IP-address have an ASCII like 8 bit encoding  like  ASCII UTF-8 CP1252, . . . ?
amigan_99Network Engineer

Author

Commented:
So what worked was your idea to clone the repository locally. I'm using Windows but I have Git Bash shell on here. From there i could run your original search criteria. Seems odd that I can't search Github enterprise for a simple IP address through their web interface. But this will work great as we have hundreds of network devices. Thank you.

MINGW64 ~/Downloads/network-configs-master123/network-configs-master
$ grep -rn '10.74.15.50' ./*
./prod-lb73-fiji.internal.acme.com:1191:add lb vserver prcc.acme-80 HTTP 10.74.15.50 80 -persistenceType NONE -cltTimeout 180
./prod-lb73-fiji.internal.acme.com:1192:add lb vserver prcc.acme-443 SSL 10.74.15.50 443 -persistenceType NONE -cltTimeout 180
./prod-lb83-fiji.internal.acme.com:1191:add lb vserver prcc.acme-80 HTTP 10.74.15.50 80 -persistenceType NONE -cltTimeout 180
./prod-lb83-fiji.internal.acme.com:1192:add lb vserver prcc.acme-443 SSL 10.74.15.50 443 -persistenceType NONE -cltTimeout 180

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial