Question: I have a file with specific numbers in a column and I want to extract lines which have those numbers in column 3 from another file.

For example, I have `extract.file` with:

```
123
689
456

```

And `input.file` with

```
1 AB 123 home 123
1 AC 568 cat 568
1 BC 689 dog 123
1 BB 456 car 456

```

And I want an outcome file with only:

```
1 AB 123 home 
1 BC 689 dog
1 BB 456 car

```

I used 

```
grep -wF -f extract.file input.file > output.file

```

But this includes the last column too:

```
1 BC 689 dog 123

```

So how can I search only in column 3 and exclude the last column from output?

Answer: 
use regular expression in your pattern file:

```
[0-9]\+ [A-Z]\+ 123
[0-9]\+ [A-Z]\+ 689
[0-9]\+ [A-Z]\+ 456

grep -f   extract.file input.file
1 AB 123 home 123
1 BC 689 dog 123
1 BB 456 car 456

```
You could use `cut`:

```
grep -wF -f extract.file input.file | cut -d" "  -f1,2,3,4  >  output.file

```