Solved

How to replace bracket with space?

Posted on 2009-04-13
4
683 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 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
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…

739 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