Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有像这样的领域
a_b_c_d
我想作为输出 ab c_d,此查询不适用于此
awk -F"_" <file> | '{print $1,$2,$3}'
因为它只会打印 abc
尝试
awk -F"_" -f <file> '{ print $1" "$2" "$3"_"$4 }'
换句话说,
$echo a_b_c_d | awk -F"_" '{ print $1" "$2" "$3"_"$4 }' a b c_d
括号中的代码表示