metascript and printclonedep
will move to metascript Signed-off-by: philippe lhardy <philippe.lhardy@astrolabe.coop>
This commit is contained in:
19
lib/awk_lib.sh
Normal file
19
lib/awk_lib.sh
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user