Solved

How to replace bracket with space?

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

895 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

17 Experts available now in Live!

Get 1:1 Help Now