- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- grep a filename in a file
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2002 11:21 AM
01-03-2002 11:21 AM
$myenv/*.log
in a file a.a and the file a.a has the exact same characters as above, what's the grep command (using csh). Note: $myenv is an environment variable. I tried backslashes, single quotes, double quotes, and combinations.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2002 11:29 AM
01-03-2002 11:29 AM
Re: grep a filename in a file
Try the same in quotes "$myenv/*.log"
Hope this helps.
Regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2002 11:31 AM
01-03-2002 11:31 AM
Re: grep a filename in a file
grep "$env.*.log" a.a
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2002 11:33 AM
01-03-2002 11:33 AM
Re: grep a filename in a file
or if you want to "evaluate" $myenv before doing the grep then:
grep "$myenv\/\*\.log" a.a
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2002 11:40 AM
01-03-2002 11:40 AM
Re: grep a filename in a file
None of your suggestions work, however I think Harry is the closest since a backslash is supposed to stop the special meaning of a character.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2002 11:42 AM
01-03-2002 11:42 AM
Re: grep a filename in a file
1. if you want to do the variable substitution with the contents of myenv, do this:
eval "grep "$myenv/*.log" a.a"
2. if you are looking for the exact string $myenv, do this:
grep "\$myenv\/\*.log" a.a
HTH
--
mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2002 11:46 AM
01-03-2002 11:46 AM
Re: grep a filename in a file
grep '\$myenv\/\*\.log' test
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2002 11:46 AM
01-03-2002 11:46 AM
Re: grep a filename in a file
----
2. if you are looking for the exact string $myenv, do this:
----
grep "\$myenv\/\*.log" a.a
and it didn't return anything. Could you try it under csh ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2002 11:46 AM
01-03-2002 11:46 AM
Re: grep a filename in a file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2002 11:47 AM
01-03-2002 11:47 AM
Re: grep a filename in a file
replace "test" with "a.a", in my last example.
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2002 11:52 AM
01-03-2002 11:52 AM
Re: grep a filename in a file
Everything is literal.
Harry,
Your second response works fine, however I only gave you 7 points because I want to see if there are any other different suggestions.
If you reply again I'll give you your remaining points once I see everyone gives up.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2002 11:53 AM
01-03-2002 11:53 AM
Re: grep a filename in a file
grep "\$myenv/\*.log" *
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2002 11:53 AM
01-03-2002 11:53 AM
Re: grep a filename in a file
Harry's last was the correct syntax, I left off the \ before the . in my example sorry. This is what I got to work in csh (did a direct cut-n-paste instead of retyping it):
grep '\$myenv\/\*\.log' a.a
--
mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2002 11:56 AM
01-03-2002 11:56 AM
Re: grep a filename in a file
grep '\$myenv\/\*\.log' a.a
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2002 11:57 AM
01-03-2002 11:57 AM
Re: grep a filename in a file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2002 11:59 AM
01-03-2002 11:59 AM
Re: grep a filename in a file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2002 12:03 PM
01-03-2002 12:03 PM
Solution--
mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2002 12:20 PM
01-03-2002 12:20 PM
Re: grep a filename in a file
Darn, I hate it when work interrupts me when I'm tring to answer a forums question!
Darrell