[Trisquel-users] Re : Grep consumes all my RAM and swap ding a big job

lcerf at dcc.ufmg.br lcerf at dcc.ufmg.br
Thu Jul 25 02:05:34 CEST 2019


Your new 'grep' takes one single input: the output of sort -k 2 *.txt, which  
is *not* binary (and happened to have the file descriptor 63 in your  
execution).  That 'grep' never sees the files that match .txt.  So, of  
course, it cannot write their names.

Reading and writing a same file (HNusage/HNs.bst.lt/temp) in a same command  
line is still nondeterministic.  I spent four posts explaining it to you.  I  
will not do it again: learn pipes and redirections.

Learning regular expressions is not optional before using 'grep'.  Again: a  
dot (all over HNusage/HNs.bst.lt/temp) means "any character".  Not  
necessarily a dot.  And again: 'grep' selects lines containing the pattern.   
Not necessarily as a whole "field" (a concept that does not exists in  
'grep').  For instance, if the pattern "0" is still in  
HNusage/HNs.bst.lt/temp, all lines including "0" are selected.  And I see  
little reason why a sorted input would fasten 'grep' (maybe branch  
prediction... but most probably your new command line does not do the same  
thing as the previous one).

Apart from actually being correct, the solution with 'join' is probably  
faster.  I would actually be interested in the run time comparison.


More information about the Trisquel-users mailing list