# echo "1234567890ABCDEFG" | awk '{if(length($0)>10){ $0=substr($0, 0, 10)"..." }; print $0;}'
1234567890...
# echo "12345" | awk '{if(length($0)>10){ $0=substr($0, 0, 10)"..." }; print $0;}'
12345
把第10个以后的字符都替换成...
字符串长度不足10, 直接输出原字符串
阅读(1696) | 评论(0) | 转发(0) |