题解 | #格式化输出#
格式化输出
https://www.nowcoder.com/practice/d91a06bfaff443928065e611b14a0e95
awk '{ l=length($0) f=l%3 for (i=1;i<=l;i++){ printf substr($0,i,1) if((i-f)%3==0 && i!=l) printf "," } print "" }' nowcoder.txt
格式化输出
https://www.nowcoder.com/practice/d91a06bfaff443928065e611b14a0e95
awk '{ l=length($0) f=l%3 for (i=1;i<=l;i++){ printf substr($0,i,1) if((i-f)%3==0 && i!=l) printf "," } print "" }' nowcoder.txt
相关推荐