【发布时间】:2013-01-26 00:47:59
【问题描述】:
我正在编写以下 bash 脚本:
# contents of dbfake file
1 100% file 1
2 99% file name 2
3 100% file name 3
#!/bin/bash
# cat out data
cat dbfake |
# select lines containing 100%
grep 100% |
# print the first and third columns
awk '{print $1, $3}' |
# echo out id and file name and log
xargs -rI % sh -c '{ echo %; echo "%" >> "fake.log"; }'
exit 0
这个脚本可以正常工作,但我如何打印第 3 列中的所有内容,然后打印之后的所有列?
【问题讨论】: