更新时间:2023-02-18 13:00:47
match
将变量RLENGTH
设置为匹配的子字符串的长度,并加以利用.另外,您不需要为此使用多字符RS
.
match
sets variable RLENGTH
to the matched substring's length, make use of it. Also, you don't need a multi-char RS
for this.
awk -v start_g="$start_gaps" -v end_g="$end_gaps" '
/^>/ { hdr=$0; next }
match($0,/^-*/) && RLENGTH<=start_g && match($0,/-*$/) && RLENGTH<=end_g { print hdr; print }
' file