[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: possible bug--please help!!!
From: |
Aharon Robbins |
Subject: |
Re: possible bug--please help!!! |
Date: |
Wed, 13 Jan 2010 23:15:02 +0200 |
Greetings. Re the below.
Please let me know what version of gawk you're using (gawk --version).
If it's not 3.1.7, then please try that version. If you are still getting
strange results, try setting
export LC_ALL=C
from the shell and re-running.
If you *still* get strange results, then please send me (off list) a
copy of your program and a small data file that shows the results and
I'll see if I can find the problem.
Thanks,
Arnold
> Date: Wed, 13 Jan 2010 11:56:40 -0800
> From: address@hidden
> To: "address@hidden" <address@hidden>
> Subject: possible bug--please help!!!
>
> Hello! I have never submitted a bug before so please let me know if
> you need more details from me.
>
> Background: I am calling gawk from a script (#!/bin/gawk). My input
> file, as viewed from VIM, is 439 lines long. On each line are
> uppercase letters with no spaces.
> Example Input: ABCERFDHDSAEGJKL
>
> My desired output is a newly created line that is alphabetized and unique.
> Example Output: ABCDEFGHJKLRS
>
> In order to do this, I read input into an array, like this.
>
> gawk 'BEGIN {FS = "" ; RS = "\n"};
> {
> for(x=1;x<=NF;x++)
> {
> array[x]=$x
> };
> asort(array);
> for(y=1;y<=NF;y++)
> {
> printf"%c",array[y]
> };
> printf"\n"
> }
>
> For the most part, this works, except for the first time there is some
> sort of repetition. Occasionally, my output becomes ABCDEFGHJKLRP.
> The last letter is swapped! This renders my awk program completely
> useless. Is this a bug or am I screwing something up here?
>
> Thank you so much for your time!
>
> Best,
>
> Natt
>
- Re: possible bug--please help!!!,
Aharon Robbins <=