[algogeeks] Re: Amazon Question-Linux Shell

2010-09-22 Thread Minotauraus
That will also match 999.9.99.9 which isn't an ip address. On Sep 21, 6:46 am, Neeraj 17.neera...@gmail.com wrote: *grep -R \[0-9]\+.[0-9]\+.[0-9]\+.[0-9]\+\ * | awk -F':' '{print $1}' | uniq * works on my system :P On Tue, Sep 21, 2010 at 2:07 PM, Chi c...@linuxdna.com

[algogeeks] Re: Amazon Question-Linux Shell

2010-09-21 Thread Chi
With perl installed: find directory | xargs perl -pi -e 's/needle/replace/g' With sed installed: #!/bin/bash find directory mirror exec 3mirror while read file 3 do replace=`more $file | sed -r -e 's/needle/replace/g'` cat $replace $file done On Sep 19, 11:30 pm, bittu

[algogeeks] Re: Amazon Question-Linux Shell

2010-09-21 Thread Minotauraus
grep /home/user/dir -d recurse -H \b(?:(?:25[0-5]|2[0-4][0-9]|[01]? [0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b the ugly looking block matches IP address. GREP is a gnu regex utility in linux (also available for windows). /home/user/dir is the location of the directory -d

Re: [algogeeks] Re: Amazon Question-Linux Shell

2010-09-21 Thread Neeraj
*grep -R \[0-9]\+.[0-9]\+.[0-9]\+.[0-9]\+\ * | awk -F':' '{print $1}' | uniq * works on my system :P On Tue, Sep 21, 2010 at 2:07 PM, Chi c...@linuxdna.com wrote: With perl installed: find directory | xargs perl -pi -e 's/needle/replace/g' With sed installed: #!/bin/bash find

[algogeeks] Re: Amazon Question-Linux Shell

2010-09-21 Thread Chi
What does [0-9]\+. means? Why do you nested it? On Sep 21, 3:46 pm, Neeraj 17.neera...@gmail.com wrote: *grep -R \[0-9]\+.[0-9]\+.[0-9]\+.[0-9]\+\ * | awk -F':' '{print $1}' | uniq * works on my system :P On Tue, Sep 21, 2010 at 2:07 PM, Chi c...@linuxdna.com wrote: With perl installed:

[algogeeks] Re: Amazon Question-Linux Shell

2010-09-21 Thread Prem Mallappa
@Neeraj: Your approach is good, this however lists .999.999.999 which is not a valid IP address. grep -lR [0-255]\.[0-255]\.[0-255]\.[0-255] * further filter out the output of above to invalidate any ip address that are reserved. -l is for suppressing normal output and printing only

[algogeeks] Re: Amazon Question-Linux Shell

2010-09-21 Thread Prem Mallappa
Sorry this doesn't work all grep out there ... On 22 Sep, 01:40, Prem Mallappa prem.malla...@gmail.com wrote: @Neeraj: Your approach is good, this however lists .999.999.999 which is not a valid IP address. grep -lR [0-255]\.[0-255]\.[0-255]\.[0-255] * further filter out the output of