- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- grep -E using variables
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
04-30-2008 02:53 PM
04-30-2008 02:53 PM
$ cat > arch_prueba
dani
paula
pedro
beto
$ grep -E '$a | $b' arch_prueba
grep: $ anchor not at end of pattern.
$ grep -E '"$a|$b' arch_prueba
grep: $ anchor not at end of pattern.
$ grep -E '`echo $a`|`echo $b`' arch_prueba
grep: $ anchor not at end of pattern.
please let me know.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2008 02:55 PM
04-30-2008 02:55 PM
Re: grep -E using variables
$ a=dani
$ b=beto
$ cat > arch_prueba
dani
paula
pedro
beto
$ grep -E '$a | $b' arch_prueba
grep: $ anchor not at end of pattern.
$ grep -E '"$a|$b' arch_prueba
grep: $ anchor not at end of pattern.
$ grep -E '`echo $a`|`echo $b`' arch_prueba
grep: $ anchor not at end of pattern.
how can i fix it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2008 02:56 PM
04-30-2008 02:56 PM
Re: grep -E using variables
a=`date "+%b %d"`
aa=`perl -MPOSIX -le 'print strftime "%b %d",localtime(time-86400)'`
$ grep -E '$a|$aa' /var/adm/syslog/syslog.log
grep: $ anchor not at end of pattern.
please help me !!!
thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2008 02:59 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2008 03:05 PM
04-30-2008 03:05 PM
Re: grep -E using variables
it worked :
grep -e "$a" -e "$aa" /var/adm/lp/log
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2008 03:15 PM
04-30-2008 03:15 PM
Re: grep -E using variables
Although I prefer the '-e' with the separate operands, had you used double quotes, you could have used '-E' :
# a=paula; b=beto
# grep -E "$a|$b" arch_prueba
paula
beto
Regards!
...JRF...