Answer the question
In order to leave comments, you need to log in
How to find lines by filter in large files?
Hello, tell me how to write a command in linux
. I have a file that cannot be read in RAM 23GB, this is essentially a sql dump (text)
I need to display the numbers of all lines where the expression DROP TABLE IF EXISTS occurs
example:
in the file 100% there is such a line
i I'm trying to do this:
DROP TABLE IF EXISTS `crosses`;
cat < dump.sql | wc -l | grep -i 'DROP TABLE IF EXISTS' | awk {'print $1'}
cat < dump.sql | wc -l | grep -i 'DROP TABLE IF EXISTS'
Answer the question
In order to leave comments, you need to log in
It's kind of weird you're doing this...
cat dump.sql | grep 'DROP TABLE IF EXISTS' -n
will output the line number and the line itself
Let me explain what was wrong in your team. It looks like you don't quite understand the pipeline ( | ) principle.
cat < dump.sql | wc -l | grep -i 'DROP TABLE IF EXISTS' | awk {'print $1'}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question