Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Separating one long column into many

Status
Not open for further replies.

hll22

Programmer
Aug 15, 2006
2
US
I'm a total beginner, I know this is probably a very simple task but as I have no experience, I don't know how to do this. I have a file, one long column of values, I want to separate it into 2 columns so just the first 100 values in the first column and the second 100 values in the second column...how do I do this?
 
hope this helps

Code:
awk 'BEGIN {i=0;j=0} {  if (j==10) {print $0,"split"; i++; j=0} j++ } END {print i}'  data
 
How about a non-awk solution:

Code:
cat data|xargs -n 100
 
thank you! The cat line works, but it makes it into two lines of 100 values instead of 2 columns of 100 lines.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top