Consider I've a large file containing information like (part of cat file
):
33.829037 -0.113737 1.157153
33.830036 -0.113620 1.157157
33.831036 -0.113495 1.157169
33.832035 -0.113365 1.157191
33.833035 -0.113242 1.157228
33.834034 -0.113157 1.157273
33.835033 -0.113071 1.157300
The first column contains float numbers in ascending order and suppose I want to remove all the line after 33.832035
so-that output should be:
33.829037 -0.113737 1.157153
33.830036 -0.113620 1.157157
33.831036 -0.113495 1.157169
33.832035 -0.113365 1.157191
How do I do that with sed
or appropriate text-processing tool?
I've tried Deleting all lines after first occurrence of a string in a line but haven't succeed in implementing in my case.
sed
. – Pandya Mar 02 '18 at 15:42p
is not necessary? – Pandya Mar 02 '18 at 15:51-n
meansp
isn’t necessary.sed
’s prints the pattern space by default, which is whatp
does too;-n
disables that behaviour and is only necessary when you don’t want to print all processed lines (which isn’t the case here). – Stephen Kitt Mar 02 '18 at 15:52