Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


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

Rep: Reputation: 31
Word search in files using Bash

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:

$ 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
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!
shell$ man grep


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 > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:56 AM.

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