DaemonForums  

Go Back   DaemonForums > Miscellaneous > Programming

Programming C, bash, Python, Perl, PHP, Java, you name it.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   (View Single Post)  
Old 22nd September 2008
18Googol2's Avatar
18Googol2 18Googol2 is offline
Real Name: whoami
Spam Deminer
 
Join Date: Apr 2008
Location: pwd
Posts: 283
Thanked 20 Times in 18 Posts
Default Command to find and replace, but not creating a new file

So I have a file, with a bunch of pattern "foo", and I wanna replace them with "bar":

Code:
blah1 foo1 blah2 blah3 foo2 blah4foo3
We all know all the pattern can be replaced by `sed` command, the catch is, you need to create a "temp" file to hold the output.

I wouldnt bother if the file size is just a couple of Kb, but, what if its a few hundred of Mb, Im restricted in disk space, then you are in trouble.

I think vim can do this with "-c" switch if iirc, but I believe there is a more elegant command out there...
__________________
The power of plain text? It can control an entire OS
Reply With Quote
 

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Find command (Linux options?) deadeyes FreeBSD General 11 23rd August 2009 06:07 PM
Creating 2 slices Beastie FreeBSD Installation and Upgrading 7 23rd March 2009 12:22 AM
Running a command with input from a file. bigb89 Programming 4 21st January 2009 06:36 PM
how to enable file/command completion for ksh93? TerryP General software and network 1 31st August 2008 08:23 AM
Find pattern in a file and erase it c0mrade Programming 8 25th June 2008 05:31 PM


All times are GMT. The time now is 11:53 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick