Добавление столбца с тем же ключом в файл

Это будет работать для MyISAM, но не для InnoDB. См.https://serverfault.com/a/367321/57569

Из этого ответа про InnoDB:

If you are thinking of just copying the.frm and.ibd file, you are in line for world of hurting. Copying the.frm and.ibd file of an InnoDB table is only good if you can guarantee that the tablespace id of the.ibd file matches exactly with the tablespace id entry in the metdata of the ibdata1 file.

-2
15.04.2020, 19:15
1 ответ

GNU awk

gawk -F '|' -v OFS='|' '
  {
    n = split($3, fields, /\^/)
    key = $1 substr(fields[3], 1, 4)
    alarms[key] = alarms[key] sep[key] $3
    sep[key] = "^^"
  }
  END {
    PROCINFO["sorted_in"] = "@ind_num_asc"
    for (key in alarms) print gensub(/....$/, "", 1, key), "Alarm", alarms[key]
  }
' file
1
19.03.2021, 02:28

Теги

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