VeecoTech
VeecoTech

Reputation: 2143

Grep command search

Hi i have a folder which it has a lot of files.. I would like to know which file contains the number e.g. 980398123. I am in Putty and i have cd to the path containing those files.. So how do i search it using Grep.

grep 980398123 "waht to put here" 

Since I am search all the files, there will be no file name .. so waht should i put there?

Also, is there a way for me to search in within the time frame? Let say i want to grep those files contains the word within a date range?

Upvotes: 1

Views: 280

Answers (2)

Tilo
Tilo

Reputation: 33732

you need the find command to recursively go through the directories, e.g. your current directory '.'

find . -type f -exec grep -l 980398123 {} \;

you can also use regular expressions in your grep command to search for date ranges

See:

man find , man grep

Upvotes: 2

emco
emco

Reputation: 4709

What about * ? If you want to make the recursive seach, you need to add the -r option. So, your comand would be like this: grep -r "980398123" *

Upvotes: 0

Related Questions