LinuxAnswers - the LQ Linux tutorial section.
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 07-03-2008, 08:31 PM   #1
LQ Newbie
Registered: Jul 2008
Posts: 2

Rep: Reputation: 0
grep *.tpl is not working

Linux version: Slackware 11.0.0

grep -rl bar ./*tpl
grep: ./*tpl: No such file or directory

But with
grep -rl bar ./*php

Why does it not work with extnesion tpl?


Last edited by ravipat; 07-03-2008 at 08:39 PM.
Old 07-03-2008, 08:46 PM   #2
Senior Member
Registered: Jan 2006
Location: Charleston, SC, USA
Distribution: Debian, Gentoo, Ubuntu, RHEL
Posts: 1,148
Blog Entries: 1

Rep: Reputation: 48
This is because there are no files with a tpl ending in the current directory. The * doesn't get expanded by grep, it gets expanded by the shell before grep ever sees it.
Old 07-03-2008, 08:57 PM   #3
LQ Newbie
Registered: Jul 2008
Posts: 2

Original Poster
Rep: Reputation: 0
grep -rl barcode ./*php

grep -ril barcode *.tpl */*.tpl
grep: *.tpl: No such file or directory

But with grep -rl barcode ./*tpl
It does not return any file though there is file with string barcode "equipment_maintain_due_assaign_wo.tpl"
Old 07-03-2008, 09:18 PM   #4
Registered: May 2005
Location: St. Louis, MO
Distribution: CentOS6
Posts: 267

Rep: Reputation: 58
grep lists lines in file(s) that partially match a pattern. The -l option lists the file name that does include a line that matches the pattern. If one is trying to list filenames that have a pattern one needs to generate a a list of filenames to match against. Try:
$ ls *.tpl | grep barcode
In other words: grep searches in the selected files, not the filenames.



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
I am learning sed / grep working and am stuck with a problem chris_looks Linux User Groups (LUG) 2 08-06-2007 02:31 PM
find | grep <pattern> not working duvalr Linux - Software 4 09-17-2006 05:07 AM
Regular Expression + not Working with grep scottwmackey Linux - General 2 06-21-2006 02:31 AM
-r parameter not working in grep learnfast Linux - Newbie 1 03-11-2005 05:17 AM
Perl - Tpl file - Need to replace new line character. knnirmal Programming 2 09-07-2004 03:27 PM

All times are GMT -5. The time now is 10:25 PM.

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