Need Help of filtering string from a file.

HI All,
We have an Redhat Machine,
And some folder with couple simple text files, this files containing a lot of lines with various strings and IP address with different classes.

The Requirement in eventually , is to pass the all various IP addresses to Excel.

My question is : what is the correct command with grep and/or Wildcards, or any other way,to get output from the files with only IP addresses that existing on these files?

I want to mention again that the IP address that exist of any each file are in different Classes, the rows in the files are not organized.
For example , in one line in the file, exist couple ip address and they before and after various expressions in the file.

I would appreciate your help.

Post examples of every different kind of record.

Let's try not to complicate it,
What is the right way to use grep, or any other filter command, to filter file with strings and ip address , and pull-out only outoput of IP Address?

There are many ways to approach this, with GNU grep you could try this->

grep -orsh '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' .
1 Like

Thanks Man!!!! you solve the issue :slight_smile: this is the command i search.