Re: change character ordering within a record

From: Robert Bonomi (bonomi_at_host122.r-bonomi.com)
Date: 07/26/05


Date: Tue, 26 Jul 2005 05:06:33 -0000

In article <1122351043.229874.190260@z14g2000cwz.googlegroups.com>,
 <kanpeter@graduate.hku.hk> wrote:
>Hi all,
>
>How can I change the character ordering, say to move the 4th-6th
>characters to 2nd-4th positions and move the 2nd-3rd characters to
>5th-6th positions within a record which may contain space character?
>
>('123456 90' -> '145623 90')
>
>
>Peter
>

when you have an 'awkward' problem, awk(1) is usually the answer.

use the substr function on $0 to extract the particular character
sequences, and printf to output the re-ordered line.



Relevant Pages

  • change character ordering within a record
    ... How can I change the character ordering, ... 5th-6th positions within a record which may contain space character? ... Peter ...
    (comp.unix.shell)
  • Re: Non-beneficial Gaps
    ... relative to the number of potential character arrangements drops off ... ratio of potentially meaningful vs. meaningless 2-character sequences ...
    (talk.origins)
  • Re: Non-beneficial Gaps
    ... relative to the number of potential character arrangements drops off ... ratio of potentially meaningful vs. meaningless 2-character sequences ... or the minimum degree of sequence specificity needed for certain kinds ... that is two to three hundred residues wide and a likely minimum gap ...
    (talk.origins)
  • Re: printing % with printf(), use of (escape) character
    ... > about the tab character; printfjust copies it the same ... > printf() to stop copying and do something else, ... > and the strings don't contain any backslash characters ... > it could perfectly well have used the backslash character. ...
    (comp.lang.c)
  • Re: Further question on compose keys
    ... >>I would like to set up compose key sequences for Unicode characters. ... > national character, so it can only be input to a UTF8-enabled ... Where can I set these enviroment variables so they ...
    (comp.os.linux.x)