Perl script to continuously compare value from lines
I have a file called "data.txt". And inside the data file, I have briefly
Code:
PacketID 1 temperature 25 Code:
PacketID 1 temperature 25 |
What have you written so far?
|
Hi Eminempark,
you can achieve this with the help of bash command it self Code:
$ cat data.txt | sort -t " " -k 4 -nu Code:
perl -e 'system "(cat data.txt | sort -t \" \" -k 4 -un)"'; Thanks, Bijo |
So, your algorithm is intended to eliminate all records that are not unique in the second column, or just the ones that are consecutive with the record(s) immediately preceding, or.... It is impossible to know without some explanation. In part, I ask because I want to coerce you to think about the problem so that you will better learn how to solve them for yourself, or at the very least, how to compose a question about a problem.
--- rod. |
Quote:
Code:
$id = 0; |
Quote:
|
Quote:
Code:
$id = 0; |
You're on the right track...
Code:
|
Quote:
|
It works for me:
Code:
--- rod. |
Quote:
|
All times are GMT -5. The time now is 08:06 AM. |