T
T
tistas2011-05-28 11:49:42
Image processing
tistas, 2011-05-28 11:49:42

Easiest way to remove all lines that don't start with a given substring from a text file?

I am not strong in programming, but I assume that this is not a difficult task. Perhaps there are some user functions in some text editor that will solve my problems.
Question: can you share an idea how to solve the problem?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
I
Iskander Giniyatullin, 2011-05-28
@tistas

Open Excel, take your file, paste it into the table (so that each line is on a separate line of the table)
Then, using the “sort and filter” button, set it so that only the lines you need remain.
After that, select them all and copy them to a new file.
Actually that's all

S
shsmad, 2011-05-28
@shsmad

cat file | sed '/regexp/d' > file2

or
cat file | grep -v -e regexp > file2

V
Vlad Zhivotnev, 2011-05-28
@inkvizitor68sl

grep -v ^string file.txt > file.txt

T
tistas, 2011-05-28
@tistas

apparently I'm not just not strong, but generally not aware. Where can such a string be entered?

M
mdevils, 2011-05-28
@mdevils

What programming environment are we talking about?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question