LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   grep: memory exhausted (https://www.linuxquestions.org/questions/linux-newbie-8/grep-memory-exhausted-4175477293/)

jojanmpaul 09-16-2013 07:18 AM

grep: memory exhausted
 
Command used,

grep -v -f fileToExclude.txt ContentFileList.txt > ContentFileList_out.txt

Error thrown,

grep: memory exhausted

the files has more than o.1 million lines and more over this command consumes 100% of CPU and 60-70% of memory.

and,

grep --version
GNU grep 2.6.3

rpm -qa | grep grep
grep-2.6.3-3.el6.i686

I need the solution for 'memory exhausted' and 'CPU and memory conception'.

pan64 09-16-2013 07:46 AM

try to sort both input files and you can implement a simple filter in perl or awk or ...

jpollard 09-16-2013 10:45 PM

As referenced above - sort the files. Once sorted you can filter them using comm - which allows you to identify common/differences between the two files and output what you want. Refer to the manpage on comm.

jojanmpaul 02-04-2014 03:09 AM

Quote:

Originally Posted by pan64 (Post 5028460)
try to sort both input files and you can implement a simple filter in perl or awk or ...

Spit the files is also useful to achieve this but time consuming...

jpollard 02-04-2014 09:06 AM

The only times I've run across the "memory exhausted" message has been when scanning a file of data extracted from a Microsoft Office file... which had one line per paragraph, with VERY long paragraphs.

But I was not using a file to hold the patterns... How many patterns are in that file (fileToExclude.txt)?


All times are GMT -5. The time now is 08:02 PM.