From cc4df1775ce7598c7502aa48448b9355757899bf Mon Sep 17 00:00:00 2001 From: Philippe PITTOLI Date: Sat, 22 Jun 2024 01:34:39 +0200 Subject: [PATCH] Add the sql to final migration file format script. --- bin/sql-to-migration-format.awk | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 bin/sql-to-migration-format.awk diff --git a/bin/sql-to-migration-format.awk b/bin/sql-to-migration-format.awk new file mode 100755 index 0000000..caacb6e --- /dev/null +++ b/bin/sql-to-migration-format.awk @@ -0,0 +1,23 @@ +#!/usr/bin/awk -f + +BEGIN { + OFS = "\t" +} + +{ + login = $1 + domain = $3 + data[login][domain] = 1 +} + +END { + for ( login in data ) { + domains = "" + nb = 0 + for ( domain in data[login] ) { + nb += 1 + domains = (domains "\t" domain) + } + print nb, login, domains + } +}