A B C ............ till G
sucnpde067.advancemags.com- Successful Full FS_UNIX_801_Fri_C Full_Backup 0B Failed Full FS_UNIX_801_Fri_B Full_Backup 0B ............ till G
sucnpde066.advancemags.com- Successful Full FS_UNIX_801_Fri_C Full_Backup 0B Successful Full FS_UNIX_801_Fri_C Full_Backup 0B ............ till G
slnssde052.advancemags.com- Failed Full FS_UNIX_801_Fri_B Full_Backup 0B Successful Full FS_UNIX_801_Fri_C Full_Backup 0B ........... till G
slnssde048.advancemags.com- Failed Full FS_UNIX_801_Fri_B Full_Backup 0B Failed Full FS_UNIX_801_Fri_B Full_Backup 0B ............ till G
仅在B,C,D,E和B中有任何一个打印列A. G包含使用Linux shell失败
我也需要,仅在最终现有专栏未包含成功的情况下打印专栏A.
注意-Coulmns是制表符/逗号分隔
答案 0 :(得分:1)
grep -v Failed <FILENAME> | awk '{print $1}'
答案 1 :(得分:0)
grep "Failed" FILENAME | cat FILENAME - | sort | uniq -d | egrep -o "^\w*"
答案 2 :(得分:0)
假设您不想要的最后一列包含&#34;成功&#34;没有任何尾随空格...
grep "Failed" <FILENAME> | grep -vE "successful^" | awk -F'[\t,]' '{print $1}'