- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Output of the script..
Operating System - HP-UX
1748123
Members
3400
Online
108758
Solutions
Forums
Categories
Company
Local Language
юдл
back
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
юдл
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
тАО02-23-2009 03:46 PM
тАО02-23-2009 03:46 PM
Hi,
I am trying to understand the output of the below shell script line.
Test2=$(/usr/ucb/ps -xuww | sed -n '/[w]eblogic.Server/ s/.*weblogic.Name=\([^ ]*\) .*/\1/p')
I am running script in debug mode but not seeing any values in the field Test2 during execution.
Can someone explain me the above script snippet in detail ?
Thanks,
Shiv
I am trying to understand the output of the below shell script line.
Test2=$(/usr/ucb/ps -xuww | sed -n '/[w]eblogic.Server/ s/.*weblogic.Name=\([^ ]*\) .*/\1/p')
I am running script in debug mode but not seeing any values in the field Test2 during execution.
Can someone explain me the above script snippet in detail ?
Thanks,
Shiv
Solved! Go to Solution.
- Tags:
- sed
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-23-2009 03:55 PM
тАО02-23-2009 03:55 PM
Re: Output of the script..
Have you tried running all the parts on their own - to see what is happening?
eg what do these give you:
/usr/ucb/ps -xuww
AND
/usr/ucb/ps -xuww | sed -n '/[w]eblogic.Server/ s/.*weblogic.Name=\([^ ]*\) .*/\1/p'
eg what do these give you:
/usr/ucb/ps -xuww
AND
/usr/ucb/ps -xuww | sed -n '/[w]eblogic.Server/ s/.*weblogic.Name=\([^ ]*\) .*/\1/p'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-23-2009 05:08 PM
тАО02-23-2009 05:08 PM
Solution
Hi Shiv:
Well this isn't HP-UX (it looks like Solaris) but that aside your description says that there was nothing returned from the output after 'sed' was run.
The 'sed' looks for lines with "weblogic.Server". If found, the string following "weblogic.Name=" is captured (because of the encapsulating parentheses) and substituted (the '\1' expression without any blanks matched (the [^ ] portion.
Regards!
...JRF...
Well this isn't HP-UX (it looks like Solaris) but that aside your description says that there was nothing returned from the output after 'sed' was run.
The 'sed' looks for lines with "weblogic.Server". If found, the string following "weblogic.Name=" is captured (because of the encapsulating parentheses) and substituted (the '\1' expression without any blanks matched (the [^ ] portion.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-23-2009 05:55 PM
тАО02-23-2009 05:55 PM
Re: Output of the script..
>/[w]eblogic.Server/
This use of "[w]" for "w" is a standard trick so that the sed or grep doesn't find itself:
ps -ef | grep foo
This will find the process foo and the grep of foo (and any other uses of foo).
A better trick is to use not use grep:
UNIX95=EXTENDED_PS ps -f -C foo
This use of "[w]" for "w" is a standard trick so that the sed or grep doesn't find itself:
ps -ef | grep foo
This will find the process foo and the grep of foo (and any other uses of foo).
A better trick is to use not use grep:
UNIX95=EXTENDED_PS ps -f -C foo
- Tags:
- EXTENDED_PS
- PS
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP