Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Pattern problem

by ptum (Priest)
on Jan 27, 2006 at 14:18 UTC ( [id://525975]=note: print w/replies, xml ) Need Help??


in reply to Pattern problem

Maybe something as simple as this?

#!/usr/local/bin/perl use strict; while (<DATA>) { if (/Host System [^#]/) { print "$_"; } } __DATA__ Status Host Pluto up Host System Pluto 10.1.4.11 Host System Mars IP 10.1.3.10 Status Host Jupiter down Host System #neptune IP 10.10.10.10 Disk load Mars imminent Host System Venus IP 12.1.2.13.14

No good deed goes unpunished. -- (attributed to) Oscar Wilde

Replies are listed 'Best First'.
Re^2: Pattern problem
by mk. (Friar) on Jan 27, 2006 at 14:33 UTC
    or simply
    perl -ne 'print if /Host System [^#]/;' records.txt


    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    grrr.... argh!
      perl -pe 's/(Host System [^#].+)|.+/$1/gs' records.txt
      =****

      Mago
      mago@rio.pm.org


Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://525975]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-03-28 13:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found