Skip to main content
deleted 1 character in body; deleted 2 characters in body
Source Link

awk again,
input any suite of values separated by , and newlines,
output a fixed-width csv:

awk '{b=printf(b(FNR>1?b"(FNR-1)%n?",":ORS:"")$0}0==FNR%n{print b;b="")}END{if(b)print b""}' RS='[,\n]' n=4 <<END Hello Hi,Hullo,Hammers,Based Random END Hello,Hi,Hullo,Hammers Based,Random 

awk again,
input any suite of values separated by , and newlines,
output a fixed-width csv:

awk '{b=(b?b",":"")$0}0==FNR%n{print b;b=""}END{if(b)print b}' RS='[,\n]' n=4 <<END Hello Hi,Hullo,Hammers,Based Random END Hello,Hi,Hullo,Hammers Based,Random 

awk again,
input any suite of values separated by , and newlines,
output a fixed-width csv:

awk '{printf((FNR>1?(FNR-1)%n?",":ORS:"")$0)}END{print ""}' RS='[,\n]' n=4 <<END Hello Hi,Hullo,Hammers,Based Random END Hello,Hi,Hullo,Hammers Based,Random 
deleted 5 characters in body
Source Link

awk again,
input any suite of values separated by , and newlines,
output a fixed-width csv:

awk '{b=(b?b",":"")$0}0==FNR%n{print b;b=""}END{if(b)print b}' RS='[,\n]' n=4 <<END Hello Hi,Hullo,Hammers,Based Random END Hello,Hi  ,Hullo,Hammers Based,Random 

awk again,
input any suite of values separated by , and newlines,
output a fixed-width csv:

awk '{b=(b?b",":"")$0}0==FNR%n{print b;b=""}END{if(b)print b}' RS='[,\n]' n=4 <<END Hello Hi,Hullo,Hammers,Based Random END Hello,Hi  Hullo,Hammers Based,Random 

awk again,
input any suite of values separated by , and newlines,
output a fixed-width csv:

awk '{b=(b?b",":"")$0}0==FNR%n{print b;b=""}END{if(b)print b}' RS='[,\n]' n=4 <<END Hello Hi,Hullo,Hammers,Based Random END Hello,Hi,Hullo,Hammers Based,Random 
added 143 characters in body
Source Link

awkawk again,
input any suite of values separated by , and newlines,
output a fixed-width csv:

awk '{b=(b?b",":"")$0}0==FNR%n{print b;b=""}END{if(b)print b}' RS='[,\n]' n=2 <<<n=4 "Hello,<<END Hello Hi,Hullo,Hammers,Based,Random" Random END  Hello,Hi Hullo,Hammers Based,Random 

awk again:

awk '{b=(b?b",":"")$0}0==FNR%n{print b;b=""}END{if(b)print b}' RS='[,\n]' n=2 <<< "Hello,Hi,Hullo,Hammers,Based,Random" Hello,Hi Hullo,Hammers Based,Random 

awk again,
input any suite of values separated by , and newlines,
output a fixed-width csv:

awk '{b=(b?b",":"")$0}0==FNR%n{print b;b=""}END{if(b)print b}' RS='[,\n]' n=4 <<END Hello Hi,Hullo,Hammers,Based Random END  Hello,Hi Hullo,Hammers Based,Random 
Source Link
Loading