LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 08-11-2013, 05:51 AM   #1
Grtyop
Member
 
Registered: May 2013
Location: Over the Rainbow..
Distribution: LinuxMint , RedHat
Posts: 31

Rep: Reputation: Disabled
grep question.


Click image for larger version

Name:	grepq1.PNG
Views:	31
Size:	26.5 KB
ID:	13174

Why does grep -i a display b.txt as well ?
 
Old 08-11-2013, 06:14 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389
Quote:
Originally Posted by Grtyop View Post
Attachment 13174

Why does grep -i a display b.txt as well ?
Because there's an a in Aug. Grep looks at the whole line, not just the files.
 
1 members found this post helpful.
Old 08-11-2013, 06:22 AM   #3
rosehosting.com
Member
 
Registered: Jun 2012
Location: Missouri, USA
Posts: 222

Rep: Reputation: 62
You can try without the '-l' flag:
Code:
ls |grep -i a

Last edited by rosehosting.com; 08-11-2013 at 06:23 AM.
 
Old 08-11-2013, 06:39 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,353
Blog Entries: 55

Rep: Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541
* http://mywiki.wooledge.org/ParsingLs
 
  


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
Creating an alias in ksh that uses grep and includes 'grep -v grep' doug248 Linux - Newbie 2 08-05-2012 02:07 PM
grep question sudz28 Linux - Newbie 4 01-21-2009 07:13 PM
grep question tokernizer Programming 2 12-20-2005 08:02 AM
grep question Hockeyfan Linux - General 1 05-15-2004 02:09 AM
grep question vasanthraghavan Programming 3 04-23-2004 12:32 AM


All times are GMT -5. The time now is 11:50 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