2

I have two files: one which is the dictionary, and the other one corresponds to the list of words that appear in a transcription. I need to output the words out of vocabulary words. This is:

dict.txt
you 
she
apple
banana
strawberry
eat

transcript.txt
you
strawberry
and 
banana
<silence>
for 
breakfast

So, my desired output would look like this:

and
for
breakfast
<silence>

Is there any command output such words that are not found in the dictionary? thanks in advance!

2
  • aspell is one... Commented May 12, 2018 at 12:01
  • What about <silence>? Commented May 12, 2018 at 12:11

1 Answer 1

3
grep -vf dict.txt transcript.txt
    and
    <silence>
    for
    breakfast

fix

The above solution treats the file content as patterns. That does work in this example but not in general. In order to match the full lines literally you need:

grep -vFxf dict.txt transcript.txt
8
  • When I run that command I got "killed" :/ Commented May 12, 2018 at 12:22
  • @little_mice: Where is killed coming from? Is it an error or a word in one of your files? Commented May 12, 2018 at 12:35
  • When I run that command in the terminal it outputs "killed" in the same terminal. And the file where the output should be redirect is empty Commented May 12, 2018 at 13:10
  • 1
    This command must be run in the directory containing dict.txt and transcript.txt (or specify the full path to those files. Also this command as is will not produce an output file (because you have not asked for one), it will send the output to stdout. Commented May 12, 2018 at 13:19
  • it finally worked! the problem was that it wasn't run in the directory was @Jesse_b said. Thanks! Commented May 12, 2018 at 15:59

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.