Results 1 to 5 of 5
I have this data compose of two columns:
0 2.45566
1 2.46678
0 2.47667
1 2.48778
0 2.49638
0 2.49767------
1 2.50990
what i want to do is getting rid ...
- 08-18-2010 #1Just Joined!
- Join Date
- Aug 2010
- Posts
- 3
how to select columns and rows from a text file
I have this data compose of two columns:
0 2.45566
1 2.46678
0 2.47667
1 2.48778
0 2.49638
0 2.49767------
1 2.50990
what i want to do is getting rid of rows which repeat each other on the first column. For example i want to delete 6th row due to there is 0 after a 0.
once i delete the row ( which has dashes next to it) i will have
0 2.45566
1 2.46678
0 2.47667
1 2.48778
0 2.49638
1 2.50990
so yeah i want to write sth with awk or sed i don know just to get rid of all repetitive rows like that.
raw study
awk '{chaine=substr($0,2,1);if (chain(i)==chain(i+1)) print $0}' data.txt
its supposed to be sth like that additional with a for loop addition
so i will say
for i 1 to end of rows ( work in 1st column)
if the value of ith row in the first column == i+1 th value
then delete i+1 th row..
end
Thanks a lot..
- 08-20-2010 #2Just Joined!
- Join Date
- Mar 2005
- Location
- Corona, CA
- Posts
- 29
I think uniq will do what you want, it can remove duplicates.
- 08-20-2010 #3Just Joined!
- Join Date
- Aug 2010
- Posts
- 3
but how am i gonna select only first column? there is no duplication in the second column...
Thanks,
- 08-20-2010 #4
- 08-23-2010 #5Just Joined!
- Join Date
- Aug 2010
- Posts
- 3
It s still not workin
shud i use python instead?


Reply With Quote