bash - grep for multiple strings in file on different lines (ie. whole file, not line based search)? -


i want grep files containing words dansk, svenska or norsk on line, usable returncode (as have info strings contained, one-liner goes little further this).

i have many files lines in them this:

disc title: unknown title: 01, length: 01:33:37.000 chapters: 33, cells: 31, audio streams: 04, subpictures: 20         subtitle: 01, language: ar - arabic, content: undefined, stream id: 0x20,          subtitle: 02, language: bg - bulgarian, content: undefined, stream id: 0x21,          subtitle: 03, language: cs - czech, content: undefined, stream id: 0x22,          subtitle: 04, language: da - dansk, content: undefined, stream id: 0x23,          subtitle: 05, language: de - deutsch, content: undefined, stream id: 0x24,  (...) 

here pseudocode of want:

for files in directory;  if file contains "dansk" , "norsk" , "svenska"  echo filename end 

what best way this? can done on 1 line?

you can use:

grep -l dansk * | xargs grep -l norsk | xargs grep -l svenska 

if want find in hidden files:

grep -l dansk .* | xargs grep -l norsk | xargs grep -l svenska 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -