I am using Red Hat Enterprise 6 and I'm trying to search through the /etc/ directory for files that contain any IPv4 address.

  • @JeffSchaller im trying to get any ipv4 address – Sam Feb 9 at 20:40


grep -lrE '([0-9]{1,3}\.){3}[0-9]{1,3}' /etc

  • -l means list only matching files
  • -r is recursive
  • -E is extended regex

Regex taken from https://unix.stackexchange.com/a/296597/243015

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.