From cb8b0c93a1ad0b3e5cafc976efe0f259ddc324a9 Mon Sep 17 00:00:00 2001 From: Philippe PITTOLI Date: Sat, 8 Jun 2024 23:23:05 +0200 Subject: [PATCH] Add a formatting script. --- bin/format.awk | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 bin/format.awk diff --git a/bin/format.awk b/bin/format.awk new file mode 100755 index 0000000..36338f6 --- /dev/null +++ b/bin/format.awk @@ -0,0 +1,30 @@ +#!/usr/bin/awk -f + +BEGIN { + data = "" +} + +/^\[/ || /^\]/ { + print "oups" + next +} + +/^ {/ && /},$/ { + print $0 + next +} + +/^ {/ { + data = $0 + next +} + +/},$/ { + data = sprintf("%s %s", data, $0) + print data + next +} + +{ + data = sprintf("%s %s", data, $0) +}