Reputation: 13
I try to sort data
aaaaaaa
aaaaaaa
aaaaaaa
aaaaaaa
aaaaaaa
aaaaaaa
aaaaaaa
aaaaaaa
aaaaaaa
aaaaaaa
to get 3 items per line and separate by ,
.
as usual ,i will use split --line=3
after that sort with paste -s x* -d',' >result
,any shorter way to achieve my goal .
The result:
aaaaaaa,aaaaaaa,aaaaaaa
aaaaaaa,aaaaaaa,aaaaaaa
aaaaaaa,aaaaaaa,aaaaaaa
aaaaaaa
Thanks much.
Upvotes: 1
Views: 50
Reputation: 45243
the sample data is terrible, can you update it? Otherwise, no one understands your question.
Here I try to guess your request:
sort file |paste - - - -d,
for 100 per line
sort file |xargs -n100 |sed 's/ /,/g'
Upvotes: 1