Consider a single column file which begins with
$ cat file.txt
1
yes
single
125K
no
2
no
married
100K
no
$ cat file.txt
1
yes
single
125K
no
2
no
married
100K
no
...
Suppose you want to split it into 5 columns so that it looks like
1 yes single 125K no
2 no married 100K no
...
You can use either,
$ xargs -n5 < file.txt
or if you want some control over the delimiter
$ paste - - - - - -d, < file.txt
1,yes,single,125K,no
2,no,married,100K,no
No comments:
Post a Comment