From e4f154efc62a410ac2eee538022a79598e03a655 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Fri, 25 Aug 2017 15:45:39 +0400 Subject: [PATCH] =?UTF-8?q?uawk:=20possibilit=C3=A9=20de=20lancer=20les=20?= =?UTF-8?q?versions=20locale-aware?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ulib/awk | 8 +++----- uawk | 24 ++++++++++++++++-------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/lib/ulib/awk b/lib/ulib/awk index 2a289b0..1de1465 100644 --- a/lib/ulib/awk +++ b/lib/ulib/awk @@ -1140,19 +1140,17 @@ function lawkcsv2fsv() { done shift - lawkcsv -v fields[@] -v sizes[@] -a ' -{ + lawkcsv -v fields[@] -v sizes[@] -a '{ line = "" for (i = 1; i <= fields_count; i++) { size = sizes[i] + 0 - value = get(fields[i]) + value = get(fields[i]) "" while (length(value) < size) value = value " " if (length(value) > size) value = substr(value, 1, size) line = line value } print line -} -' -- "$@" +}' -- "$@" } function cawkcsv2fsv() { LANG=C lawkcsv2fsv "$@"; } diff --git a/uawk b/uawk index c59351a..9b6d3ec 100755 --- a/uawk +++ b/uawk @@ -45,14 +45,22 @@ fi # Aliases pour les noms d'outils case "$tool" in -run) tool=awkrun;; -csv) tool=awkcsv;; -grep) tool=grepcsv;; -fsv2csv|fsv) tool=awkfsv2csv;; -csv2fsv) tool=awkcsv2fsv;; -merge) tool=mergecsv;; -sort) tool=sortcsv;; -dump) tool=dumpcsv;; +run) tool=awkrun; toolprefix=; prefix=c; Clang=1;; +lrun) tool=awkrun; toolprefix=l; prefix=l; Clang=;; +csv) tool=awkcsv; toolprefix=; prefix=c; Clang=1;; +lcsv) tool=awkcsv; toolprefix=l; prefix=l; Clang=;; +grep) tool=grepcsv; toolprefix=; prefix=c; Clang=1;; +lgrep) tool=grepcsv; toolprefix=l; prefix=l; Clang=;; +fsv2csv|fsv) tool=awkfsv2csv; toolprefix=; prefix=c; Clang=1;; +lfsv2csv|lfsv) tool=awkfsv2csv; toolprefix=l; prefix=l; Clang=;; +csv2fsv) tool=awkcsv2fsv; toolprefix=; prefix=c; Clang=1;; +lcsv2fsv) tool=awkcsv2fsv; toolprefix=l; prefix=l; Clang=;; +merge) tool=mergecsv; toolprefix=; prefix=c; Clang=1;; +lmerge) tool=mergecsv; toolprefix=l; prefix=l; Clang=;; +sort) tool=sortcsv; toolprefix=; prefix=c; Clang=1;; +lsort) tool=sortcsv; toolprefix=l; prefix=l; Clang=;; +dump) tool=dumpcsv; toolprefix=; prefix=c; Clang=1;; +ldump) tool=dumpcsv; toolprefix=l; prefix=l; Clang=;; esac scriptname="$toolprefix$tool"