LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-09-2010, 05:34 PM   #1
nnjond
Member
 
Registered: Feb 2007
Distribution: Ubuntu 10.04
Posts: 281

Rep: Reputation: 31
Word search in files using Bash


Hi,
Can someone help me please/

I'm trying to use Bash to search some directories for a word in one of documents. I've tried:

Code:
$ grep -R Brzeninski /media/disk-1/Dual_Data/
but It never returned a prompt, and i'm not sure what grep means or does.
 
Old 10-09-2010, 06:01 PM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
I don't really see why your command wouldn't work, unless there's just a really gigantic amount of files/data to search through. How long did you let it run? Depending on amount of data to search, it could take a while. Or, narrow down the search a bit, by giving a more specific path, or filename with wildcard(s).

Also, if you just want the name of the file(s) that contains the keyword, use -lR (it's a lowercase "L") instead of just -R.

You aren't literally using Bash to search, you're using `grep` - and as to what grep is and does, it searches through files, for lines containing keywords and regular expressions. Please see the man page!
Code:
shell$ man grep
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with BASH to search text files on disk purveshk Linux - Newbie 5 06-23-2015 03:31 PM
How can i read two files word by word at a time using any loop by shell script? vaibhavs17 Programming 16 03-19-2010 04:48 AM
[SOLVED] how to search word in group of files using command sumeet inani Linux - Newbie 20 11-09-2009 08:46 AM
search a file for a word - bash script paul_mat Linux - Software 12 04-16-2006 02:59 AM
I have a harddrive that I want to search for deleted word files, what do I do first? abefroman Linux - Security 2 07-31-2005 08:37 PM


All times are GMT -5. The time now is 03:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration