awk - grepping/awking to remove entire line that contains a specific character -


I have a grep (possibly awk?) Question that I have the following data (2 colon, different from tab)

  a._testudineus anm a_battery art a_capella_singing act | Psy a_cappella_singing act | Psy  

i For example, the results I want are:

  a._testudineus anm a_battery art   

Is there a quick / efficient grep / awk that can help me with this? The data is too large (approximately 5 GB).

Thanks in advance.

grep is the device:

  $ Grep -v "|" File  

You can also use awk , of course:

  $ awk '! / / | / 'File a. _STASTININAZA AM A_BATTERY ART  

I go to grep because this device is specially designed for such things: man Grep is called print line matching a pattern .


In fact, we copy the file 1000 times and compare the execution time:

  $ wc file 4404 8808 101292 file  
  $ time grep -v "|" Real 0m0.031s user 0m0.000s sys 0m0.012s $ Open file '! / \ | / 'File real 0m0.030s user 0m0.005s sys 0m0.010s  

and 10000 file real lines also:

  $ wc file 44404 88808 1021292 File $ time grep -v "|" Real 0m0.300s user 0m0.028s sys 0m0.068s $ time awk '! / \ | / 'File true 0m0.314s user 0m0.009s sys 0m0.063s  

Comments