Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Simple regexp question

by Tanktalus (Canon)
on Mar 31, 2006 at 03:42 UTC ( #540359=note: print w/replies, xml ) Need Help??


in reply to Simple regexp question

"I just can't get it to work" implies there is something you've tried. What is it?

/[#*]/ seems like the right idea to me, but perhaps that isn't fitting into the code you've got, so more context would help us help you.

Replies are listed 'Best First'.
Re^2: Simple regexp question
by droog114 (Initiate) on Mar 31, 2006 at 05:54 UTC
    Hi, sorry for the lack of info, I am new at this. Anyways, my text file features the following set of lines at variable lengths # **************************** I basically just want to get rid of all #'s and *'s in the file.
      perl -pe "s/[#*]//g" infile > outfile
      or in-place:
      perl -i.bak -pe "s/[#*]//g" filename
      If you want to delete the entire line, then
      perl -pe "next if /[#*]/" infile > outfile
      or in-place:
      perl -i.bak -pe "next if /[#*]/" filename

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2023-06-10 07:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you go to conferences?






    Results (37 votes). Check out past polls.

    Notices?