LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 03-07-2003, 06:32 PM   #1
mister_math
Member
 
Registered: Feb 2003
Location: /USA/IL/Chicago
Distribution: Ubuntu 5.10
Posts: 37

Rep: Reputation: 15
Perl script: how to substitute through entire document?


I think this is a simple Perl question, but for some reason I can't find out how to do this online.

All I want is a Perl script which takes multiple files as inputs, searches through each of them for a particular character, and changes that character to another character every time it occurs. That's all.
 
Old 03-07-2003, 08:55 PM   #2
mister_math
Member
 
Registered: Feb 2003
Location: /USA/IL/Chicago
Distribution: Ubuntu 5.10
Posts: 37

Original Poster
Rep: Reputation: 15
Never mind, found the answer at:
http://www.ms.uky.edu/~carl/help98/litperl1.html
 
Old 03-08-2003, 12:38 AM   #3
m0rl0ck
Member
 
Registered: Nov 2002
Distribution: A totally 133t distro :)
Posts: 358

Rep: Reputation: 31
Wouldnt this also work?

perl -p -i -e 's/this/that/g' filename


From: http://www.linuxplanet.com/linuxplanet/tutorials/214/1/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell script: substitute a file's content according to a map? Chowroc Programming 11 11-15-2005 05:08 AM
Converting a Windows Perl script to a Linux Perl script. rubbercash Programming 2 07-19-2004 11:22 AM
Perl: here-document help Scruff Programming 7 01-15-2004 11:30 PM
how to find the pid of a perl script from shell script toovato Linux - General 1 12-19-2003 07:25 PM
Including methods from a perl script into another perl script gene_gEnie Programming 3 01-31-2002 06:03 AM


All times are GMT -5. The time now is 11:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration