metascript and printclonedep

will move to metascript

Signed-off-by: philippe lhardy <philippe.lhardy@astrolabe.coop>
This commit is contained in:
2025-11-01 15:12:45 +01:00
parent 65cc0f4c62
commit ab6746ed5c
10 changed files with 1201 additions and 36 deletions

19
lib/awk_lib.sh Normal file
View File

@@ -0,0 +1,19 @@
awk_inplace() {
local awk_script="$1"
local file="$2"
enforce file "$awk_script" exists
enforce file "$file" exists
local tmp_file='awkXXXXXXXXXX.out'
[[ -z $defer ]] && tmp_file=$(mktemp "$tmp_file")
enforcefile "$tmp_file" exists
execredirectto $tmp_file awk -f $awk_script $file
$metarun cp $tmp_file $file
$metarun rm $tmp_file
# gawk uniquely
# if gawk is wanted
# $metarun apt install gawk
# $metarun awk -i inplace -f $awk_script $file
}