Re: [SLUG] grep does not put the filename in front of every match

From: Alex Harris (nccuss17@gmail.com)
Date: Thu Mar 03 2005 - 09:52:26 EST


Many, many, many thanks, it worked.
I'm very thankful for your help.

On Thu, 03 Mar 2005 08:01:00 -0500, Kwan Lowe <kwan@digitalhermit.com> wrote:
> Alex Harris wrote:
> > humm, which version of grep are you using, every instance I've tried
> > brings back the results I mentioned (only the first hit on a line has
> > the filename)?
> >
> > version's I've used:
> > rh 9: 2.5.1
> > debian sarge: 2.5.1
> > cygwin: 2.5
> > -- Also, did you include the "o" after the H?
>
> Ahh... Just created a text file and found out what's happening...
>
> If you have multiple IP addys on the same line it will place the later
> entries on separate lines.
>
> What you could probably do is nest a couple loops:
>
> for item in `ls`; do
> for IP_ADDRS in `egrep -o
> "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" ${item}`; do
> echo -n ${item}:
> echo ${IP_ADDRS}
> done
> done
>
> Script is attached.
>
>
>
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:15:30 EDT