uawk: possibilité de lancer les versions locale-aware

This commit is contained in:
Jephté Clain 2017-08-25 15:45:39 +04:00
parent ef00e07b21
commit e4f154efc6
2 changed files with 19 additions and 13 deletions

View File

@ -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 "$@"; }

24
uawk
View File

@ -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"