Solved

How to replace bracket with space?

Posted on 2009-04-13
4
675 Views
Last Modified: 2012-05-06

My log is as below. I want to replace bracket with space. I have tried ~s/(/ /g; and ~s#(# #g; but it doesn't work. Does anybody know any way to do this?

Thanks very much!


From:

acl_Application_access permitted tcp 192.168.113.38(3394) 10.108.80.11(135)

acl_Application_access permitted tcp 192.168.201.57(3395) 10.108.80.11(1025)

acl_Application_access permitted tcp 192.168.34.169(3396) 10.108.80.11(445)
 

To:

acl_Application_access permitted tcp 192.168.113.38 3394 10.108.80.11 135

acl_Application_access permitted tcp 192.168.201.57 3395 10.108.80.11 1025

acl_Application_access permitted tcp 192.168.34.169 3396 10.108.80.11 445

Open in new window

0
Comment
Question by:howruaz9
  • 2
4 Comments
 
LVL 84

Assisted Solution

by:ozo
ozo earned 300 total points
ID: 24131914
$log = '
acl_Application_access permitted tcp 192.168.113.38(3394) 10.108.80.11(135)
acl_Application_access permitted tcp 192.168.201.57(3395) 10.108.80.11(1025)
acl_Application_access permitted tcp 192.168.34.169(3396) 10.108.80.11(445)
';

$log  =~  s/[()]/ /g;
print $log;
0
 
LVL 10

Accepted Solution

by:
oleber earned 200 total points
ID: 24131975
probably is more like

$log = '
acl_Application_access permitted tcp 192.168.113.38(3394) 10.108.80.11(135)
acl_Application_access permitted tcp 192.168.201.57(3395) 10.108.80.11(1025)
acl_Application_access permitted tcp 192.168.34.169(3396) 10.108.80.11(445)
';

$log  =~  s/\(/ /g;
$log  =~  s/\)//g;
print $log;
0
 
LVL 84

Assisted Solution

by:ozo
ozo earned 300 total points
ID: 24131996
#or
s/\(/ /g,s/\)//g for $log;
0
 

Author Comment

by:howruaz9
ID: 24134024
Three methods work very well. Thanks so much ozo and oleber.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now