Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


grep ips from BFD bans, invalid back reference ?

Posted on 2006-05-16
Medium Priority
Last Modified: 2010-08-05
from shell,

bfd -a | grep '\([0-9]{1,3}(\.[0-9]{1,3}){3})\1'

Gives me the error invalid back reference,

bfd -a | grep -P "[0-9]{1,3}(\.[0-9]{1,3}){3}"
prints proftpd proftpd proftpd proftpd proftpd proftpd proftpd proftpd proftpd proftpd

How do I just capture the ip's and loose anything after it ?
Question by:ghboom
  • 2
LVL 15

Expert Comment

ID: 16695784
> grep '\([0-9]{1,3}(\.[0-9]{1,3}){3})\1'

-) what are you trying to match ?
-) the number of opening and closing "(" does not match
-) the "-P" argument to grep is missing

Author Comment

ID: 16695861
oops my bad,
I pasted the wrong error...
I have been trying many examples from various sources
learning about this, ultimatly I have tried

bfd -a | grep -P "\([0-9]{1,3}(\.[0-9]{1,3}){3}\)\1"

however there is no results returned...

what I am looking for is to, only have the IPs returned, not any txt.

so typing
bfd -a | grep -P "[0-9]{1,3}(\.[0-9]{1,3}){3}" proftpd proftpd

I would like to only have ips retrned like,

LVL 48

Accepted Solution

Tintin earned 1000 total points
ID: 16696021
bfd -a | grep -P "[0-9]{1,3}(\.[0-9]{1,3}){3}" |awk '{print $1}'

Author Comment

ID: 16696163
great, works like a charm !!

Thanks ;)

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Often times it's very very easy to extend a volume on a Linux instance in AWS, but impossible to shrink it. I wanted to contribute to the experts-exchange community a way of providing a procedure that works on an AWS instance. It can also be used on…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses
Course of the Month10 days, 16 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question