Solved

global search and replace

Posted on 2002-06-18
1
146 Views
Last Modified: 2010-03-05
Hi
I have a 350 MB file in unix and want to replace all the occurences of "+0100]" with "+0000]".
It could be easily achieved with a perl script, but unfortunately i don't know much of that.

i need some perl script which does that or anything else which serves the purpose.
something like

perl script.pl oldfilename.txt <oldstring> <newstring> > newfilename.txt

thanks
Khem
0
Comment
Question by:k_suchdeva
1 Comment
 
LVL 10

Accepted Solution

by:
rj2 earned 100 total points
ID: 7090732
You can do that with this one-liner, just paste the line below into the command line, change file.txt to correct filename.
Original file will be renamed to e.g. file.txt.bak

perl -i.bak -pe 's/\+0100\]/+0000]/' file.txt

0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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.…
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…
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…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

744 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

14 Experts available now in Live!

Get 1:1 Help Now