LinuxQuestions.org
Review your favorite Linux distribution.
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 07-03-2008, 07:31 PM   #1
ravipat
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
./barcode.php

Why does it not work with extnesion tpl?

Thanks,
Ravi

Last edited by ravipat; 07-03-2008 at 07:39 PM.
 
Old 07-03-2008, 07:46 PM   #2
PatrickNew
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, 07:57 PM   #3
ravipat
LQ Newbie
 
Registered: Jul 2008
Posts: 2

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


grep -ril barcode *.tpl */*.tpl
grep: *.tpl: No such file or directory
images-navigation/equipment_maintain_work_order.tpl
subscriber/equipment_maintain_due_assaign_wo.tpl

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, 08:18 PM   #4
david1941
Member
 
Registered: May 2005
Location: St. Louis, MO
Distribution: CentOS6
Posts: 267

Rep: Reputation: 57
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.

Dave
 
  


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


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration