Hi, folks
Is there an easy way to filter based on the contents of values in adjacent rows? (a bit like the -A
“after” and -B
“before” options in ‘grep
’)
For example, if I only wanted rows containing String1 in column 2 when the next row contained String2 in column 2 … and I wanted the option of keeping all pairs of rows (or ranges of rows) that matched, would that be possible?
1 Timestamp1 String1
2 Timestamp2 String2
…
6 Timestamp6 String1
7 Timestamp7 String3
…
18 Timestamp18 String1
19 Timestamp19 String2
Would result in:
1 Timestamp1 String1
2 Timestamp2 String2
18 Timestamp18 String1
19 Timestamp19 String2
It’s not critical if the timestamp value in column 1 in the second row is lost, so if it meant provisionally concatenating column 2 of the second row onto the first’s column 2, and then filtering, that wouldn’t be a problem - I just couldn’t work out a way to do that!
Apologies if I’m attempting to use EDT for something it’s not designed for; if needs be, I could always pre-process the file in something else first. I’m still trialing EDT and am just testing out some potential uses for it.
Thanks,
Steve