Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to replace bracket with space?

Posted on 2009-04-13
4
Medium Priority
?
688 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 84

Assisted Solution

by:ozo
ozo earned 1200 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 800 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 1200 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 to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
Six Sigma Control Plans

618 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