Remove the lines that are between the given patterns from the file (using Unix tools)

I have a text file (or rather, a German-style CSV file, that is, a comma-separated, decimal comma) that has a date and dimension value for each line. There are sections of defective values ​​that I want to delete before further work. I would like to keep these abbreviations in some script so that my corrections are documented, and I can reproduce these corrections if necessary.

The lines look like this:

28.01.2005 14:48:38;5,166
28.01.2005 14:50:38;2,916
28.01.2005 14:52:38;0,000
28.01.2005 14:54:38;0,000
(long stretch of values that should be removed; could also be something else beside 0)
01.02.2005 00:11:43;0,000
01.02.2005 00:13:43;1,333
01.02.2005 00:15:43;3,250

Now I would like to save a list of start and end patterns, such as 28.01.2005 14:52:38+ 01.02.2005 00:11:43, and the script would cut the lines corresponding to these start and end pairs, and everything in between.

awk script, , , .

+5
5

sed:

sed '/start_pat/,/end_pat/d'

start_pat end_pat ().

, -e:

sed -e '/s1/,/e1/d' -e '/s2/,/e2/d' -e '/s3/,/e3/d' ...
+16

-, , ? ?

Vim.

Vim :global ( :g) : ex , . , awk, , Vim .

, - , (, caveat emptor):

:g!/^\d\d\.\d\d\.\d\d\d\d/ -1 write tmp.txt >> | delete

, (! ), tmp.txt, .

, tmp.txt, , uniq.

0

awk

awk '/start/,/end/' file
0

perl (.. OO). .

perl, ( ), , , awk, sed, grep .., .

, , , perl script ( ).

, perl unix/linux.

( sed , : -)

0

grep -L ( )

- , 0,000

-1
source

All Articles