我正在努力解决这个问题。
awk '{print $1","$10","$11","$12","$13,$14,$15,$16,$17,$18,$19}' <<< "$PASTE_1" > test.csv
Run Code Online (Sandbox Code Playgroud)
我需要打印以逗号分隔的 $1 $10 $11 $12 然后继续 $13 直到行结束,没有逗号分隔。因为从 $13 起有很多空格。
我正在编写一个 bash 脚本,我正在通过read
这两个字符串读取变量:
log.*.console.log log.*.log
Run Code Online (Sandbox Code Playgroud)
它们被空间隔开。
如何重写脚本中调用的下一个程序的变量的输出将具有这种形式的字符串? 'log.*.console.log' 'log.*.log'
我正在尝试 sed 和 awk 但不知何故没有成功。
整个脚本:
#!/bin/bash
if [ -z "$*" ] ; then
echo "USAGE: ./some text"
exit 1
else
echo "some text"
read varlogname
i=1
for file in $@
do
echo "Doing" $file
GTAR=$(gtar -xvf $file --wildcards --ignore-case --no-anchored "$varlogname")
for file in ${GTAR[*]}
do
mv $file $file"."${i}
i=$((i+1))
done
done
echo "Files extracted."
fi
exit 0
Run Code Online (Sandbox Code Playgroud)