假设我的输入文件是表格分隔的,如何获取类名和可执行时间?
- class Apple.java executed by user ABC34 executable time 980.9 ms
- class ABC.java executed by user ABC34 executable time is in sec 45.9 ss
- class TAS.java executed by user ABC34 executable time 75.9 ms
- class GW.java executed by user ABC34 executable time is in sec 0.9 ss
- class MYClass.java executed by user ABC34 executable time is in sec 7.9 ss
- class Times.java executed by user ABC34 executable time is in sec 9.9 ss
- class Sunday.java executed by user ABC34 executable time is in sec 85.9 ss
- class Week.java executed by user ABC34 executable time is in sec 1000.9 ss
我想要这样的输出
- Apple.java 980.9 ms
- ABC.java 45.9 ss
- TAS.java 75.9 ms
- GW.java 0.9 ss
- MYClass.java 7.9 ss
- Times.java 9.9 ss
- Sunday.java 85.9 ss
- Week.java 1000.9 ss
请看我的代码。我出不去
#!/bin/bash
LOGFILE=$1
SEARCH=$2
echo $SEARCH
if [ -f $LOGFILE ];
then
awk '/ABC34 / && /is in sec/ {print $2, $13, $14;}' $LOGFILE>Output.txt
awk '/ABC34 / {print $2, $8, $9;}' $LOGFILE>Output.csv
else
echo "No File Found"
fi
但是当我检查我的 Output.txt 是空的。非常感谢。