In order to parse certain log file and make a plot of sequential numbers, I need to filter out the lines with numbers which appearing lower than in the previous lines.
For example, given the list of lines with integers:
62
116
33
20
61
67
89
82
15
109
73
101
115
120
41
103
94
122
Note: File can be generated by hexdump -n100 -e '1/1 "%d" "\n"' /dev/urandom | grep -v ^-
.
I'd like to filter out (remove) the numbers that way, so all of them are sequential (so they look kind of sorted).
Ideally if the command will take into the account all the previous lines.
Here is my expected results:
62
116
120
122
If the command won't filter correctly after first time, I can always re-run it couple of times.
Here is my attempt based on this post:
:g/^/ if getline(line('.')-1) < getline('.') | delete | endif
but it removes all the lines instead.
How I should correct my command? Or what other approach I could use?