alternative for egrep -o on HP-UX


 
Thread Tools Search this Thread
Operating Systems HP-UX alternative for egrep -o on HP-UX
# 1  
Old 02-18-2010
alternative for egrep -o on HP-UX

Hello to all board members!!

I have a problem on a HP-UX system. I should write a script. Therefore I need to search after IP addresses in the output of a command.

On Debian this works:
Code:
 ifconfig | egrep -o "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"

The script where i need this is not ifconfig, but the output has a lot of rubbish and some IP addresses. And I need the IP addresses.

Another problem is that there is no way to find the IP on another way.

Is there someting avaiable on HP-Ux to search something like xxx.xxx.xxx.xxx ?

I also don't want to install the GNU egrep.
# 2  
Old 02-18-2010
Try:

Code:
... | perl -lne'print $1 while /((?:\d+\.){3}\d+)/g

# 3  
Old 02-18-2010
absolutely brilliant!!
Thank you very much. Smilie
I searched 2 days for something like this.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Tips/advise on alternative to doing egrep -v

Hi all, At the moment, I am doing the following to exclude some exception strings. The more I need to exclude, the longer the string becomes and it has become error prone as I edit the list manually. $ cat output.txt host=192.168.1.99 user=mickey host=192.168.1.99 user=mickey... (4 Replies)
Discussion started by: newbie_01
4 Replies

2. Shell Programming and Scripting

Please help -- any alternative to expect ?

Doing some automation to automate some server tasks in Linux through shell scripting. In the script I tried to call a expect script to log into another server and execute a command. Please note: passwordless SSH is not possible hence am trying some User-interactive commands like Expect to send... (2 Replies)
Discussion started by: alldbest
2 Replies

3. Shell Programming and Scripting

Looking for an alternative to Tcl

I've created quite a collection of tcl scripts which have buttons, radio buttons, check boxes, text fields, etc. These tcl scripts in turn call and execute several hundred sh, csh, bash, perl scripts and pass in the args based on the gui selections on the same and other redhat machines. We're... (4 Replies)
Discussion started by: scottwevans
4 Replies

4. Solaris

vi alternative

Is there any other editor, installed by 'default' in Sparc Solaris10, besides vi? I'd like to avoid installing anything new. If not, how to make vi more user-friendly? thanks. (8 Replies)
Discussion started by: orange47
8 Replies

5. Shell Programming and Scripting

Alternative for wc -l

Hi techies .. This is my first posting hr .. Am facing a serious performance problem in counting the number of lines in the file. The input files i get will be in some 10 to 15 Gb of size or even sometimes more ..and I will load it to db I have used wc -l to confirm whether the loader... (14 Replies)
Discussion started by: rajesh_2383
14 Replies

6. UNIX for Dummies Questions & Answers

search ")" with egrep - egrep: syntax error

Hi Guys, we have a shell script which basically query the Database which retrieves huge data and use the data with "egrep" . Now there is some data which contains characters like "abc)" and the same is used like below : "egrep (.+\|GDPRAB16\|GDPR/11702 96 abc)\|$ temp.txt" now while... (7 Replies)
Discussion started by: sagarjani
7 Replies

7. Shell Programming and Scripting

du alternative in perl

I have a perl script that just does a `du -sk -x` and formats it to look groovy ( the argument can be a directory but usually is like /usr/local/* ) #!/usr/bin/perl use strict; use warnings; my $sizes = `du -x -sk @ARGV | sort -n`; my $total = 0; print "MegaBytes Name\n"; for(split... (1 Reply)
Discussion started by: insania
1 Replies

8. Shell Programming and Scripting

help with while loop or any other alternative?

i=1 while do mm=02 dd=03 yy=2008 echo "$mm$dd$yy" i=$(( i+1)) echo "$i" done whenever i execute the script above i will get the error below: syntax error at line 30: `i=$' unexpected (3 Replies)
Discussion started by: filthymonk
3 Replies

9. UNIX for Dummies Questions & Answers

Egrep cheat sheet anywhere? Looking for meaning of egrep -c

Hi I've been searching google and have not found what egrep -c means. Does anyone know where I can get a cheat sheet or what that -c means? thanks, Linda (2 Replies)
Discussion started by: leelm
2 Replies

10. Shell Programming and Scripting

Using awk (or an alternative)

Hi, I'm trying to echo a variable that has values separated by colons, putting each value on a new line. So as an example, a variable I might have would contain: My name is Earl:My name is Dorothy:My name is Bernard: And I want the output: My name is Earl My name is Dorothy My name... (5 Replies)
Discussion started by: michaeltravisuk
5 Replies
Login or Register to Ask a Question