- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- how to grep a line in a file having '*' as a char...
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
Discussions
Discussions
Forums
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
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
тАО07-29-2010 11:21 PM
тАО07-29-2010 11:21 PM
how to grep a line in a file having '*' as a character
I am trying in this way. But not working.
FILE="/u/vinaymp/vinay.txt"
crontab -l > tempfile
while read line
do
echo "$line"
grep -E "$line" tempfile
if [ $? -eq 0 ]
then
echo "found"
else
echo "not found"
fi
done < $FILE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-29-2010 11:31 PM
тАО07-29-2010 11:31 PM
Re: how to grep a line in a file having '*' as a character
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-30-2010 12:13 AM
тАО07-30-2010 12:13 AM
Re: how to grep a line in a file having '*' as a character
You can use fgrep and you won't do any RE matching.
What's in vinay.txt?
It seems you want to go out of your with to find EREs with grep -E. If so, your vinay.txt must properly quote your EREs.
As R.K. said, you put "\*" in vinay.txt.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-30-2010 04:30 AM
тАО07-30-2010 04:30 AM
Re: how to grep a line in a file having '*' as a character
If you are looking to match fixed strings then use 'grep -F'.
In that case there is no need to escape the "*" character.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-30-2010 10:59 PM
тАО07-30-2010 10:59 PM
Re: how to grep a line in a file having '*' as a character
Enclosed * within single quote. It will search the literal character.
grep '*' vinay.txt
HTH
Muru