bug-coreutils
[Top][All Lists]
Advanced

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

Re: Replacing text?


From: Brian Dessent
Subject: Re: Replacing text?
Date: Fri, 01 Dec 2006 11:28:44 -0800

Solarius wrote:

> Is there any way to replace string with another, for example from
> standard input to standard output via commandline with GNU toolbox?

This is possible with sed, awk, perl, and probably a zillion other
tools, depending on exactly what you want to do.  But none of these are
part of GNU coreutils, they are their own projects.  However, any system
that has coreutils installed will likely have at least one of them as
well.

sed -e 's,search,replace,g'
perl -pe 's,search,replace,g'
awk '{ gsub(/search/, "replace"); print }'

> I need to "parse" text from a file or input, and replace a string and
> put conclusion to output.

That's way too generic of a description to really be able to offer any
concrete advice.

> I tried to find a way, but I didn't:(

http://www.oreilly.com/catalog/shellsrptg/
http://www.oreilly.com/catalog/unixnut4/

Brian




reply via email to

[Prev in Thread] Current Thread [Next in Thread]