- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Stop regular expression expanding list of files
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
03-23-2005 02:06 AM
03-23-2005 02:06 AM
eg export TEMPLATE='ora*log'
export SRHTEMPLATE=`echo $TEMPLATE |sed 's/\*/\\\*/g'`
grep -v $SRHTEMPLATE /tmp/file >/tmp/file2
The problem is that SRHTEMPLATE is expanded to a list of all files matching "ora*log". But! Just using $TEMPLATE for the grep command does not suppress the required lines.
Share and Enjoy! Ian Dennison
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2005 02:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2005 02:30 AM
03-23-2005 02:30 AM
Re: Stop regular expression expanding list of files
Change this to
SRHTEMPLATE=`echo "$TEMPLATE |sed 's/\*/\\\*/g'"`
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2005 02:30 AM
03-23-2005 02:30 AM
Re: Stop regular expression expanding list of files
bc02n0v0> echo "$PREVTMPL" |sed 's/\*/\\\*/g'
ora\*log
bc02n0v0> `echo "$PREVTMPL" |sed 's/\*/\\\*/g'`
sh: ora\*log: not found.
bc02n0v0>
Sorry, doesn't work inside back quotes (works without backquotes).
Share and Enjoy! Ian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2005 02:37 AM
03-23-2005 02:37 AM
Re: Stop regular expression expanding list of files
Double quotes around most of it?
bc02n0v0> `echo "$PREVTMPL |sed 's/\*/\\\*/g'"`
sh: ora*log: not found.
Strange, after a little experimentation what follows,...
Pt 1 - by itself on the command line, inside back-quotes
bc02n0v0> `echo "$PREVTMPL" |sed 's/\*/\\\*/g'`
sh: ora\*log: not found.
Pt 2 - in variable assignment, inside back quotes
bc02n0v0> export SRHTMPL=`echo "$PREVTMPL" |sed 's/\*/\\\*/g'`
bc02n0v0> echo $SRHTMPL
ora\*log
bc02n0v0>
So the same code has different results depending if it is an RValue or not.
Thanks for the assistance - as you were both right, you both get 10 pts.
Share and Enjoy! Ian