Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Pattern problem

by ptum (Priest)
on Jan 27, 2006 at 14:18 UTC ( #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? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2022-05-27 11:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (94 votes). Check out past polls.

    Notices?