On Fri, 14 Jan 2011 17:53:04 +1030, Wayne Sierke wrote:
> I suspect it is a transcription error by Robert in his email.
>
> From man awk:
>
>sub(r, t, s)
> substitutes t for the first occurrence of the regular
> expression
> r in the string s. If s is not giv
On Fri, 2011-01-14 at 07:17 +0100, Polytropon wrote:
> On Thu, 13 Jan 2011 18:22:18 -0600 (CST), Robert Bonomi
> wrote:
> > True. But
> > sub(nr,"[a-z]"," &");
> >
> > does the trick. (tested on Freebsd 7.2)
> >
> > Explamation: "&" is a 'replacement side' magic incantation to the rege
On Thu, 13 Jan 2011 18:22:18 -0600 (CST), Robert Bonomi
wrote:
> True. But
> sub(nr,"[a-z]"," &");
>
> does the trick. (tested on Freebsd 7.2)
>
> Explamation: "&" is a 'replacement side' magic incantation to the regex
> library that means 'that which was matched by the pattern regex'
> Date: Thu, 13 Jan 2011 06:28:19 +0100
> From: Polytropon
> Subject: awk question: replacing "%d%s" by "%d %s"
>
> I'm aware that this is not an awk question list, but I'm confident there
> are many awk gurus here who can surely help me with
On Thu, Jan 13, 2011 at 12:28 AM, Polytropon wrote:
> I have strings of the form either "" or
> "". I catch them with
...
> where "nr" is the name of the string. What I need
> is a simple space between and ,
> so for example "12a" would get "12 a", "6d" would
> get "6 d", and "58" would stay unc
On Thu, 13 Jan 2011 01:00:17 -0500, Tom Limoncelli wrote:
> $ awk < data.txt > experiment.txt '{ num = $1 ; sub(/[^0-9]+$/, "",
> num) ; lets = $1 ; sub(/^[0-9]+/, "", lets); print num " " lets }' ;
> diff -cw control.txt experiment.txt
> $ # The above puts a space at the end of the first 3 lines
I'm aware that this is not an awk question list, but I'm
confident there are many awk gurus here who can surely
help me with such a stupid problem. I also know that I
get more and more stupid myself for NOT being able to
solve this, even after... some nearly infinite time. :-)
I have strings of th