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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

printing the line only when a value changes 1

Status
Not open for further replies.

jkluesner

Technical User
Sep 29, 2006
24
US
Hello all,

I have a file reformated to finally look like this:

26 05 2008 2153 22 49.9985-107 52.0001
26 05 2008 2153 22 49.9985-107 52.0001
26 05 2008 2153 22 49.9985-107 52.0001
26 05 2008 2153 22 49.9986-107 52.0001
26 05 2008 2154 22 49.9985-107 52.0001
26 05 2008 2154 22 49.9985-107 52.0000
26 05 2008 2154 22 49.9985-107 52.0000
26 05 2008 2154 22 49.9986-107 52.0000
26 05 2008 2154 22 49.9986-107 52.0000

The next step I need to do is the take the first file from every minute (2153,2154) instead of having 60 files from each minute. Any suggestions? I will want a file just like the one above with only one value (the first) from each minute.

Thanks!
 
I should explain: when the expression $4!=p evaluates to true, it will print the current input line. Then {p=$4} stores the current minute value in p so it can be used on the next line of input to check whether the minute matches the previous line.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top