- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: export with grep
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-20-2005 05:01 AM
05-20-2005 05:01 AM
here> export now="/orca/oracle/admin/DRX/bdump/*.trc|grep \"May 9\""
here> echo $now
/orca/oracle/admin/DRX/bdump/*.trc|grep "May 9"
What do I need to do to fix this? – I get the same response on HP-UX and
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2005 05:17 AM
05-20-2005 05:17 AM
Re: export with grep
netstat -an | grep ":80 "
No special characters needed.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2005 05:31 AM
05-20-2005 05:31 AM
Re: export with grep
Here is the example why I use "\" ...
$ export now=/orca/oracle/admin/DRX/bdump/*.trc|grep "May 9"
$ echo $now
/orca/oracle/admin/DRX/bdump/*.trc|grep May
$ export now="/orca/oracle/admin/DRX/bdump/*.trc|grep \"May 9\""
$ echo $now
/orca/oracle/admin/DRX/bdump/*.trc|grep "May 9"
It just seems like I loose all the spaces between May and 9 -- The reason I am doing this is that the date is right justified and I need one imbedded space between the month and day if the day is lees then a 2 digit number
Example:
-rw-r----- 1 oracle dba 750 May 3 17:33 /orca/oracle/admin/DRX/bdump/drx_s000_29419.trc
-rw-r----- 1 oracle dba 1431 May 19 02:07 /orca/oracle/admin/DRX/bdump/drx_s000_32267.trc
I might be going at this wrong but it does seem to be something simple that is not working the way I would like.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2005 05:55 AM
05-20-2005 05:55 AM
Re: export with grep
there *is* a space between May and 9. What
exactly are you going to do with $now besides
echo it? This is probably a shell quoting
problem, not a problem with grep itself.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2005 06:08 AM
05-20-2005 06:08 AM
Solutionsince you escaped the inner double quotes, the expansion eliminates the multiple whitespaces. Use single quotes without escaping them inside:
export now="/orca/oracle/admin/DRX/bdump/*.trc|grep 'May 9'"
Hope this fixes it (no system to check available now)
Volker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2005 06:09 AM
05-20-2005 06:09 AM
Re: export with grep
#export now="/orca/oracle/admin/DRX/bdump/*.trc|grep \"`date '+%b %e'`\""
export now="/orca/oracle/admin/DRX/bdump/*.trc|grep \"May 9\""
echo $now
ls -l $now
if test -r '$now'
then
echo "TRC FILE ON DEVLOAD - " > /home/sbadgett/data/trc-list
# ls -l /orca/oracle/admin/DRX/bdump/*.trc|grep "$now" >> /home/sbadgett/data/trc-list
ls -l /orca/oracle/admin/DRX/bdump/*.trc|grep "May 9" >> /home/sbadgett/data/trc-list
echo "end of report" >> /home/sbadgett/data/trc-list
mail -s "!!! DEVLOAD trc file is there !!!" sbadgett@pharmcomp.com < /home/sbadgett/data/trc-list
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2005 06:16 AM
05-20-2005 06:16 AM
Re: export with grep
export now="/orca/oracle/admin/DRX/bdump/*.trc|grep 'May 9'"
I still get the same results
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2005 06:36 AM
05-20-2005 06:36 AM
Re: export with grep
what is your OS and what is your shell ?
I just verified this behavior on Linux with bash, but the environment Variable HAS stored the additional blanks! They are just not re printed, when the variable is expanded, no idea why !
I have used variable with blanks in content on Solaris today (!), this is why I suggested it this way, but now on Linux ....
Check, after "now" is set to content with several Blanks with
env | grep now
...should show the blanks !
Verify with
if [ "$now" = "your_content" ] ; then echo true; fi
with single blanks and correct number of blanks.
Looks like the forum does the same elimination !
I am confused
Volker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2005 06:49 AM
05-20-2005 06:49 AM
Re: export with grep
export now=`ll /orca/oracle/admin/DRX/bdump/*.trc|grep "May 9"|awk '{print $9}'`
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2005 06:51 AM
05-20-2005 06:51 AM
Re: export with grep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2005 07:03 AM
05-20-2005 07:03 AM
Re: export with grep
if the variable has the blanks,
try
..... | grep -e "$now"
Volker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2005 07:07 AM
05-20-2005 07:07 AM
Re: export with grep
echo -E "$now"
does the trick on Linux at least :-)
Nice nut to crack
Volker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2005 12:42 PM
05-20-2005 12:42 PM
Re: export with grep
export x="`date '+%b %e'`"
export now="`/bin/ls -l /orca/oracle/admin/DRX/bdump/*.trc|grep \"$x\"|cut -b 50-`"
echo "test"
echo $now
if test -e $now
then
echo "TRC FILE ON DEVLOAD - " > /home/sbadgett/data/trc-list
/bin/cat $now >> /home/sbadgett/data/trc-list
echo "end of report" >> /home/sbadgett/data/trc-list
mail -s "!!! DEVLOAD trc file is there !!!" sbadgett@pharmcomp.com < $now
else
echo none today
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2005 12:50 PM
05-20-2005 12:50 PM
Re: export with grep
export x="`date '+%b %e'`"
export now="`/bin/ls -l /orca/oracle/admin/DRX/bdump/*.trc|grep \"$x\"|cut -b 50-`"
if test -e $now
then
mail -s "!!! DEVLOAD trc file is there !!!" sbadgett@pharmcomp.com < $now
else
echo none today
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2005 12:51 PM
05-20-2005 12:51 PM
Re: export with grep
Stephen