Try grep -Fwf file2 file1 > out
The -F
option specifies plain string matching, so should be faster without having to engage the regex engine.
More Related Contents:
- How to delete duplicate lines in a file without sorting it in Unix
- Why does my tool output overwrite itself and how do I fix it?
- sed or awk: delete n lines following a pattern
- Convert 11/2/1998 to 110298 [duplicate]
- Some troubles with using sed and awk [closed]
- How do you delete all lines that contain no letters from the alphabet using either grep, sed, or awk? [closed]
- How can I manipulate text in bash? [closed]
- sed edit file in place
- Replace a string in shell script using a variable
- How to select lines between two marker patterns which may occur multiple times with awk/sed
- How to use variables in a command in sed?
- How to merge every two lines into one from the command line?
- How can I grep for a string that begins with a dash/hyphen?
- Extraction of data from a simple XML file
- Remove all text before colon
- How to extract just plain text from .doc & .docx files? [closed]
- How to grep for the whole word
- Extract specific columns from delimited file using Awk
- Finding contents of one file in another file
- Uppercasing First Letter of Words Using SED
- How to show only next line after the matched one?
- properly join two files based on 2 columns in common
- Using grep and sed to find and replace a string
- Remove line breaks in a FASTA file
- Extract lines between two patterns from a file [duplicate]
- grep a tab in UNIX
- grep for special characters in Unix
- Grep output with multiple Colors?
- How to grep for case insensitive string in a file?
- How to remove blank lines from a Unix file