且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

打印逗号除了在awk中的最后一行

更新时间:2023-12-04 18:51:16

我会通过查找的行数之前运行脚本,例如做用的coreutils和bash:

I would do it by finding the number of lines before running the script, e.g. with coreutils and bash:

awk -v nlines=$(wc -l < $a) '{printf "%s", $1"-"$2} NR != nlines { printf ", " }' $a >>positions