[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Search and Replace



Hi,

Yes there are quite a few ways to do that, another example:

GLOBAL REPLACE in the files:
awk '{gsub("call", "mall", $0); print > FILENAME}' *.kumac
change call to mall in all *.kumac files

Word of CAUTION: If you process really big files you may run into trouble, 
that only part of your file will be processed.  Above procedure has a limit 
about 32K lines, rest of your file will be lost!  (that was my IRIX gawk 
experience) I think sed is better, but it may have limit too.  Better check.

Sasha.

> sed was made for that.  there are lots of other tools
> that are more programming-oriented (awk, perl, python...);
> sed is simple and a bit cryptic but good to get to know.
> 
> 
> 
> John Greer wrote:
> > 
> > I know that this is not Debian specific but I thought I would give it a
> > shot anyway.  I need to search a series of files for a text string
> > (grep I know) and then I need to replace that string with another.  Is
> > there a command or string of commands that I can do this in?  If
> > this is possible it will make my life much easier!!  Thanks
> > 
> > John
> > 
> > --
> > Unsubscribe?  mail -s unsubscribe debian-user-request@lists.debian.org < /dev/null
> 
> -- 


Reply to: