- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Grep - for get words with spaces
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
05-02-2008 12:36 PM
05-02-2008 12:36 PM
When i try to pipe "May 1"i can not do it through grep command:
o=`perl -MPOSIX -le 'print strftime "%b %e",localtime(time-86400)'`
echo "cat /var/adm/lp/log | grep ""$o"""
t /var/adm/lp/log | grep May 1
Result:
cat /var/adm/lp/log | grep ""$o""
grep: can't open 1
apparently grep only is taking: May .
how can i do (what coding) for grep command takes "May 1"
thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2008 12:41 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2008 12:49 PM
05-02-2008 12:49 PM
Re: Grep - for get words with spaces
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2008 12:57 PM
05-02-2008 12:57 PM
Re: Grep - for get words with spaces
# var="May 1"
# thing="May 1"
# echo "${var}" | grep "${thing}"
May 1
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2008 01:26 PM
05-02-2008 01:26 PM
Re: Grep - for get words with spaces
shell scripts. Have you considered reading
a book on UNIX shell scripting?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2008 02:09 PM
05-02-2008 02:09 PM
Re: Grep - for get words with spaces
i had to put double ""
b=$(echo $hola | grep ""${a}"" | grep -v `hostname`)
thanks a lot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2008 02:32 PM
05-02-2008 02:32 PM
Re: Grep - for get words with spaces
THIS WAS THE SOLUTION:
b=$(echo "$hola | grep "\""${a}""\" " | grep -v `hostname`)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2008 08:56 PM
05-02-2008 08:56 PM
Re: Grep - for get words with spaces
BR,
Kapil