Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>For an input of:</p> <pre><code>"390";"902";"from 4670000 to 4679999, from 4680000 to 4689999, from 9960000 to 9969999";"something1";"something2";"20.09.04" "390";"903";"from 0770000 to 0779999, from 9170000 to 9179999";"something3";"something4";"09.09.04" </code></pre> <p>This code</p> <pre><code>#!/usr/bin/awk -f BEGIN { FS = ";" } { t = $3 gsub(/"/, "", t) n = split(t, a, /, /) for (i = 1; i &lt;= n; ++i) { print $1 ";" $2 ";\"" a[i] "\";" $4 ";" $5 ";" $6 } } </code></pre> <p>Would give </p> <pre><code>"390";"902";"from 4670000 to 4679999";"something1";"something2";"20.09.04" "390";"902";"from 4680000 to 4689999";"something1";"something2";"20.09.04" "390";"902";"from 9960000 to 9969999";"something1";"something2";"20.09.04" "390";"903";"from 0770000 to 0779999";"something3";"something4";"09.09.04" "390";"903";"from 9170000 to 9179999";"something3";"something4";"09.09.04" </code></pre> <p>Condensed form (I don't think it could really be called as a true "one-liner"):</p> <pre><code>awk -F ";" -- '{ t = $3; gsub(/"/, "", t); n = split(t, a, /, /); for (i = 1; i &lt;= n; ++i) print $1 ";" $2 ";\"" a[i] "\";" $4 ";" $5 ";" $6 }' </code></pre> <p>And this code</p> <pre><code>#!/usr/bin/awk -f BEGIN { FS = ";" } { t = $3 gsub(/"|from /, "", t) n = split(t, a, /, | to /) for (i = 1; i &lt;= n; i += 2) { print $1 ";" $2 ";\"" a[i] "\";\"" a[i + 1] "\";"$4 ";" $5 ";" $6 } } </code></pre> <p>Would give</p> <pre><code>"390";"902";"4670000";"4679999";"something1";"something2";"20.09.04" "390";"902";"4680000";"4689999";"something1";"something2";"20.09.04" "390";"902";"9960000";"9969999";"something1";"something2";"20.09.04" "390";"903";"0770000";"0779999";"something3";"something4";"09.09.04" "390";"903";"9170000";"9179999";"something3";"something4";"09.09.04" </code></pre> <p>Condensed form:</p> <pre><code>awk -F ";" -- '{ t = $3; gsub(/"|from /, "", t); n = split(t, a, /, | to /); for (i = 1; i &lt;= n; i += 2) print $1 ";" $2 ";\"" a[i] "\";\"" a[i + 1] "\";"$4 ";" $5 ";" $6; }' </code></pre> <p>Script is tested with gawk, nawk and mawk.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload