Operating System - HP-UX
1833981 Members
1821 Online
110063 Solutions
New Discussion

Re: Regarding Regular Exprssin In HP-UX

 
Bhushi
Advisor

Regarding Regular Exprssin In HP-UX

Dear all

I want to know what are the regular Exprssion in HP-UX.

with thanx
Bhushan
3 REPLIES 3
Pete Randall
Outstanding Contributor

Re: Regarding Regular Exprssin In HP-UX

man 5 regexp


Pete

Pete
spex
Honored Contributor

Re: Regarding Regular Exprssin In HP-UX

Hi Bhushan,

$ man 5 regexp

PCS
Tor-Arne Nostdal
Trusted Contributor

Re: Regarding Regular Exprssin In HP-UX

Hi Bhusan,
MANUAL PAGES
As mentioned the manual pages should always give you more information.
It is important to know how to use the online manual pages and to become familiar of using them.

The manual pages in unix is divided into several sections 1,2,3,4,5...
If you do not specify which section to lookup in, the first match in manual pages will be shown.
'man regexp' will show 'man 3 regexp' instead of 'man 5 regexp'

REGEXP
Try to use a dictionary to give you some native language translations. This might help you understand.

A 'regulare expression' is what you write to search for a specific pattern.

Example: /etc/hosts
# My hosts file
192.168.1.122 host_a
#192.168.1.123 old_host_A
168.192.1.122 host_b

example: search for all ip addresses starting with 192 in /etc/hosts

grep '^192' /etc/hosts
the ^192 is the regulare expression
And the ^ tell the grep command to find only lines starting with 192 (from 1'st position)
Output would be:
192.168.1.122 host_a

grep '192' /etc/hosts
regulare expression = 192
This will find all lines in /etc/hosts that contain the string 192 whatever position it has on the line
Output would be:
192.168.1.122 host_a
#192.168.1.123 old_a
168.192.1.122 host_b

/Tor-Arne
I'm trying to become President of the state I'm in...