Skip to main content
added 20 characters in body; edited tags
Source Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 264

I would like to change a file so that column N+1 would be put at the end of column N for each N = odd number. For instance, if I had a file with 4 columns, the column 2 would be pasted at the end of column 1 and the column 4 at the end of column 3.

Example file: 1 2 3 4 1 2 3 4 1 2 3 4

1 2 3 4
1 2 3 4
1 2 3 4

Output file: 1 3 1 3 1 3 2 4 2 4 2 4

1 3
1 3
1 3
2 4
2 4
2 4

My filefiles have ~100 lines and ~60000 columns...

Thanks!

Mu

I would like to change a file so that column N+1 would be put at the end of column N for each N = odd number. For instance, if I had a file with 4 columns, the column 2 would be pasted at the end of column 1 and the column 4 at the end of column 3.

Example file: 1 2 3 4 1 2 3 4 1 2 3 4

Output file: 1 3 1 3 1 3 2 4 2 4 2 4

My file have ~100 lines and ~60000 columns...

Thanks!

Mu

I would like to change a file so that column N+1 would be put at the end of column N for each N = odd number. For instance, if I had a file with 4 columns, the column 2 would be pasted at the end of column 1 and the column 4 at the end of column 3.

Example file:

1 2 3 4
1 2 3 4
1 2 3 4

Output file:

1 3
1 3
1 3
2 4
2 4
2 4

My files have ~100 lines and ~60000 columns.

Source Link

Stack multiple columns

I would like to change a file so that column N+1 would be put at the end of column N for each N = odd number. For instance, if I had a file with 4 columns, the column 2 would be pasted at the end of column 1 and the column 4 at the end of column 3.

Example file: 1 2 3 4 1 2 3 4 1 2 3 4

Output file: 1 3 1 3 1 3 2 4 2 4 2 4

My file have ~100 lines and ~60000 columns...

Thanks!

Mu