Транспонирование столбцов по двум значениям

Вы хотите использовать оператор select:

select dir in /place1 /other/place /path/to/elsewhere; do cd "$dir"; break; done
0
06.02.2020, 13:08
1 ответ

Это не awk, но я добавляю сюда, потому что думаю, что это может быть полезно для вашей цели.

Начиная с

Numero_di_conferimento  Numero_Campione Identificazione Valore  Data_del_prelievo   Analisi
358172  1   80_T1_Glu_Gln   0,14    17/10/2019  Granulociti_basofili_(K/µL)
358172  1   80_T1_Glu_Gln   0,23    17/10/2019  Granulociti_eosinofili_(K/µL)
358172  1   80_T1_Glu_Gln   0,42    17/10/2019  Monociti_(K/µL)
358172  1   80_T1_Glu_Gln   0,60    17/10/2019  Granulociti_basofili_%_(%)
358172  1   80_T1_Glu_Gln   2,02    17/10/2019  Granulociti_eosinofili_%_(%)
358172  1   80_T1_Glu_Gln   2,21    17/10/2019  Linfociti_(K/µL)
358172  1   80_T1_Glu_Gln   1,67    17/10/2019  Granulociti_neutrofili_(K/µL)
358172  1   80_T1_Glu_Gln   2,96    17/10/2019  Monociti_%_(%)
358172  1   80_T1_Glu_Gln   2,4 17/10/2019  Leucociti_(WBC)_(K/µL)
358172  1   80_T1_Glu_Gln   5,74    17/10/2019  Eritrociti_(RBC)_(M/µL)
358172  1   80_T1_Glu_Gln   10,2    17/10/2019  Emoglobina_(g/dL)
358172  1   80_T1_Glu_Gln   12,6    17/10/2019  Emoglobina_globulare_media_(MCH)_(pg)
358172  1   80_T1_Glu_Gln   40,2    17/10/2019  Ampiezza_distribuzione_eritrocitaria_(RDW)_(%)
358172  1   80_T1_Glu_Gln   40,9    17/10/2019  Concentrazione_media_emoglobina_globulare_(MCHC)_(g/dL)
358172  1   80_T1_Glu_Gln   15,1    17/10/2019  Linfociti_%_(%)
358172  1   80_T1_Glu_Gln   32,2    17/10/2019  Ematocrito_(HCT)_(%)
358172  1   80_T1_Glu_Gln   63,7    17/10/2019  Volume_globulare_medio_(MCV)_(fl)
358172  1   80_T1_Glu_Gln   27,3    17/10/2019  Granulociti_neutrofili_%_(%)
358172  1   80_T1_Glu_Gln   453 17/10/2019  Piastrine_(PLT)_(K/µL)
358172  2   97_T1_Glu_Gln   2,16    17/10/2019  Granulociti_basofili_(K/µL)
358172  2   97_T1_Glu_Gln   3,47    17/10/2019  Granulociti_eosinofili_(K/µL)
358172  2   97_T1_Glu_Gln   2,79    17/10/2019  Monociti_(K/µL)
358172  2   97_T1_Glu_Gln   1,1 17/10/2019  Granulociti_basofili_%_(%)
358172  2   97_T1_Glu_Gln   4   17/10/2019  Granulociti_eosinofili_%_(%)
358172  2   97_T1_Glu_Gln   5,63    17/10/2019  Granulociti_neutrofili_(K/µL)

используя Miller(https://github.com/johnkerl/miller)и выполняя эту команду long to wide

mlr --tsv reshape -s Analisi,Valore then unsparsify input.tsv >output.tsv

у вас будет

+------------------------+-----------------+-----------------+-------------------+-----------------------------+-------------------------------+-----------------+----------------------------+------------------------------+------------------+-------------------------------+----------------+------------------------+-------------------------+-------------------+---------------------------------------+------------------------------------------------+---------------------------------------------------------+-----------------+----------------------+-----------------------------------+------------------------------+------------------------+
| Numero_di_conferimento | Numero_Campione | Identificazione | Data_del_prelievo | Granulociti_basofili_(K/µL) | Granulociti_eosinofili_(K/µL) | Monociti_(K/µL) | Granulociti_basofili_%_(%) | Granulociti_eosinofili_%_(%) | Linfociti_(K/µL) | Granulociti_neutrofili_(K/µL) | Monociti_%_(%) | Leucociti_(WBC)_(K/µL) | Eritrociti_(RBC)_(M/µL) | Emoglobina_(g/dL) | Emoglobina_globulare_media_(MCH)_(pg) | Ampiezza_distribuzione_eritrocitaria_(RDW)_(%) | Concentrazione_media_emoglobina_globulare_(MCHC)_(g/dL) | Linfociti_%_(%) | Ematocrito_(HCT)_(%) | Volume_globulare_medio_(MCV)_(fl) | Granulociti_neutrofili_%_(%) | Piastrine_(PLT)_(K/µL) |
+------------------------+-----------------+-----------------+-------------------+-----------------------------+-------------------------------+-----------------+----------------------------+------------------------------+------------------+-------------------------------+----------------+------------------------+-------------------------+-------------------+---------------------------------------+------------------------------------------------+---------------------------------------------------------+-----------------+----------------------+-----------------------------------+------------------------------+------------------------+
| 358172                 | 1               | 80_T1_Glu_Gln   | 17/10/2019        | 0,14                        | 0,23                          | 0,42            | 0,60                       | 2,02                         | 2,21             | 1,67                          | 2,96           | 2,4                    | 5,74                    | 10,2              | 12,6                                  | 40,2                                           | 40,9                                                    | 15,1            | 32,2                 | 63,7                              | 27,3                         | 453                    |
| 358172                 | 2               | 97_T1_Glu_Gln   | 17/10/2019        | 2,16                        | 3,47                          | 2,79            | 1,1                        | 4                            | -                | 5,63                          | -              | -                      | -                       | -                 | -                                     | -                                              | -                                                       | -               | -                    | -                                 | -                            | -                      |
+------------------------+-----------------+-----------------+-------------------+-----------------------------+-------------------------------+-----------------+----------------------------+------------------------------+------------------+-------------------------------+----------------+------------------------+-------------------------+-------------------+---------------------------------------+------------------------------------------------+---------------------------------------------------------+-----------------+----------------------+-----------------------------------+------------------------------+------------------------+

2
06.02.2020, 10:26

Теги

Похожие вопросы