Backref2
The usual (and correct) answer for backreferences in awk (for example, the answer you can get on #awk . . . for this question) is: "you can't do backreferences in awk". That is only partly true. If . . . a pattern using a regular expression with backreferences, like eg you do in sed {{{ sed sed -n . . . do that easily with awk. But if you are using backreferences during string substitution, to insert . . . (requires GNU awk): use gensub(). It supports backreferences natively. * Second answer: sometimes . . .
2K - last updated 2009-03-26 20:24 UTC by waldner
Backreferences
The usual (and correct) answer for backreferences in awk (for example, the answer you can get on #awk . . . for this question) is: "you can't do backreferences in awk". That is only partly true. If . . . a pattern using a regular expression with backreferences, like eg you do in sed {{{ sed sed -n . . . do that easily with awk. But if you are using backreferences during string substitution, to insert . . . (requires GNU awk): use gensub(). It supports backreferences natively. Example: {{{ awk # reverse . . .
3K - last updated 2010-12-30 06:53 UTC by ppp089210039107.dsl.hol.gr
Frequently Asked Questions
Some entries of this page have been copied from the [[comp.lang.awk_FAQ]]([[http://awk.freeshell.org/comp.lang.awk_FAQ#toc29|Credits]]) . . . Edit this answer]] ---- == How do I use backreferences in awk? <include "Backreferences"> . . . [[http://awk.freeshell.org/?action=edit;id=Backreferences| Edit this answer]] ---- == How do I . . .
3K - last updated 2015-09-08 08:46 UTC by pgas
GeneralizedTextReplacement
Some times people need to recode in awk something they were previously doing with sed or another tool. . . . do as well); then, we'll see how to emulate backreferences with awk, and how that fits in the framework. . . . nth occurrence (where n!=1), or you want to use backreferences in the replacement text, then you cannot . . . 7th match # etc. see below for an example where backreferences are emulated } # here we build the new . . . powerful than sed), let's see how we can emulate backreferences with it. The way to emulate sed's backreferences . . .
6K - last updated 2009-03-26 20:38 UTC by waldner
HomePage
This wiki is maintained by regulars from the **#awk** channel on **[[https://libera.chat/|irc.libera.chat]]** . . . -- what to do if you desperately need backreferences * [[http://awk.freeshell.org/LinksPage#toc2|elsewhere . . .
5K - last updated 2023-06-26 04:15 UTC by HappMacDonald
SedFAQ
<toc> ---- == I have a line like "abdcgfjeuPATTERNfjfhghj", I want to get the PATTERN part, why . . . than nine times since many seds cannot handle backreferences greater than \9. * PATTERN occurs more . . .
34K - last updated 2010-02-14 17:56 UTC by waldner
6 pages found.