LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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, 06: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, 07:14 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
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, 07:22 AM   #3
rosehosting.com
Member
 
Registered: Jun 2012
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 07:23 AM.
 
Old 08-11-2013, 07:39 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,332
Blog Entries: 55

Rep: Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533
* 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 03:07 PM
grep question sudz28 Linux - Newbie 4 01-21-2009 08:13 PM
grep question tokernizer Programming 2 12-20-2005 09:02 AM
grep question Hockeyfan Linux - General 1 05-15-2004 03:09 AM
grep question vasanthraghavan Programming 3 04-23-2004 01:32 AM


All times are GMT -5. The time now is 11:28 PM.

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