Solved

global search and replace

Posted on 2002-06-18
1
148 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
perl script 4 106
work on ods spreadsheet with perl in ubuntu 4 76
compress files in RAR using perl 13 80
perl CPAN issue 3 109
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 …
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 Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

776 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