Results 1 to 4 of 4
ok, her e is the situation.
I have a text file:
column A seperator Column B
1 : A
2 : B
etc.
I want to convert it to rows, ...
- 05-13-2009 #1Just Joined!
- Join Date
- Mar 2009
- Posts
- 2
File / text maniplation
ok, her e is the situation.
I have a text file:
column A seperator Column B
1 : A
2 : B
etc.
I want to convert it to rows, where Column A is the first line, and column B is the second line.
Is there an easy way to do this?
thanks
John
- 05-13-2009 #2Linux User
- Join Date
- Jan 2007
- Location
- cleveland
- Posts
- 452
sed 's/:/\n/' <filename
the sun is new every day (heraclitus)
- 05-13-2009 #3Linux User
- Join Date
- Aug 2006
- Posts
- 458
OP wants a transposition.
@OP, if you have Python
outputCode:#!/usr/bin/env python a=[] for line in open("file"): line=line.strip().split(" : ") a.append(line) for i in zip(*a): print ' : '.join(i)
Code:# ./test.py 1 : 2 A : B
- 05-13-2009 #4
@tpl, not sure if that sed command does the job. may be I tried on wrong file.
I guess he wants something like:
Name Id
A 1234
B 2343
C 5656
converted to:
Name A B C
Id 1234 2343 5656
I tried with above and it did not work.A candle looses nothing by lighting other candles. - Khalil Zibran.
Registered Linux User #490076


Reply With Quote