- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- What is the output
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
06-28-2007 12:47 AM
06-28-2007 12:47 AM
grep "^d"
grep "d[0-9]"
\ after 2nd grep
awk '{print $3}'
for DSTUFF in `cat $STFILE | grep "^d" | grep "d[0-9]" | \
sed -e's/\"Schema Area\"/\"Schema_Area\"/' | awk '{ print $3}'`
Thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2007 12:53 AM
06-28-2007 12:53 AM
Re: What is the output
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2007 12:53 AM
06-28-2007 12:53 AM
Re: What is the output
Do you mean the backslash (\)?
with the \ you can write a command on two line you could also write the command like this:
for DSTUFF in `cat $STFILE | grep "^d" | grep "d[0-9]" | sed -e's/\"Schema Area\"/\"Schema_Area\"/' | awk '{ print $3}'`
Hope this helps..
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2007 12:53 AM
06-28-2007 12:53 AM
Re: What is the output
The backslash denotes a line continuation allowing the pipeline to be written across two lines.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2007 12:59 AM
06-28-2007 12:59 AM
Solution...or are you asking about each listed item?
1. The caret (^) anchors the match of the "d" to the beginning of a line.
2. The [0-9] means match any number from 0 to 0.
3. The "\" is a line continuation character when it occurs after the second 'grep' allowing the pipeline to be written on two lines. The use of the backslash ('\') in the 'sed' command is to escape the double quote character and thus tell 'sed' to treat it as part of its match and substitute.
4. The 'awk' statement is printing the third (counting from one) field of whitespace delimited fields in the data stream it receives from the pipe.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2007 01:00 AM
06-28-2007 01:00 AM
Re: What is the output
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2007 02:11 AM
06-28-2007 02:11 AM
Re: What is the output
btw... you de realize that is a disgusting piece of work right?
for DSTUFF in `cat $STFILE | grep "^d" | grep "d[0-9]" | sed -e's/\"Schema Area\"/\"Schema_Area\"/' | awk '{ print $3}'`
If uses 5 images and 4 processes for a job which awk or perl can do in s single pass.
In perl (untested)
perl -lne 'if (/^d/ && /d[0-9]/) { s/Schema Area/Schema_Area/; print (split)[2]' $STFILE
I also suspect that the d[0-9] is likely to trigger on the same d at the start of line and that the substitue effectively only reduced the colun count. The whole script migth reduce to:
awk '/^d[0-9]/{ print $4 }' $STFILE
Regards,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2007 11:08 AM
06-28-2007 11:08 AM
Re: What is the output
>Hein: The whole script migth reduce to:
awk '/^d[0-9]/{ print $4 }' $STFILE
You don't know about $4 since it may need that sed(1) to change some of the lines so it gives a consistent $3.