Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: perl one liner to search for a string, then search for a different string and append a new line

by BradV (Sexton)
on Dec 20, 2012 at 14:18 UTC ( [id://1009749]=note: print w/replies, xml ) Need Help??


in reply to perl one liner to search for a string, then search for a different string and append a new line

Great! 99.9% there. :)

Current code is:

perl -0777 -elnp 's|(<Directory "/usr/local/awstats.+?</Directory>)|$1+\nCustomLog /usr/local/awstats/logs/access_log comdinedio|s' httpd.conf

It does everything I want, except there is a line-feed followed by another line-feed and a question mark after 'combinedio.' That is:

CustomLog ... combinedio ?

Any ideas how to get rid of at least the question mark?

  • Comment on Re: perl one liner to search for a string, then search for a different string and append a new line
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: perl one liner to search for a string, then search for a different string and append a new line
by BradV (Sexton) on Dec 20, 2012 at 14:32 UTC
    I found the reason for the question mark. I had a typo and was using 'perl -077' instead of 'perl -0777.' All is good.

    Thanks so much for your help! :)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-24 05:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found