• + 0 comments

    The problem with the awk 'ORS=NR%2?";":"\n"' solution is it'll produce output that's separated by \ns which would be undesirable on a system where records are separated by \r\n, e.g. as is common in file created on Windows. awk 'ORS=NR%2?";":RS' solves that by using RS instead of "\n" in the script but then THAT would fail if the RS was the number 0 or similar. The robust, portable solution is awk '{ORS=(NR%2 ? ";" : RS)} 1' file