- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: awk and else statements
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
Discussions
Discussions
Forums
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
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-21-2007 05:39 AM
тАО05-21-2007 05:39 AM
Re: awk and else statements
I assumed that it outputs more than one. And with that assumption, my awk fragment worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-21-2007 07:23 AM
тАО05-21-2007 07:23 AM
Re: awk and else statements
~cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-21-2007 08:20 PM
тАО05-21-2007 08:20 PM
Re: awk and else statements
looks like I forgot {} for the else statement.
will add this to my never ending notes.
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-21-2007 08:28 PM
тАО05-21-2007 08:28 PM
Re: awk and else statements
sandman you are correct line should be >0 and not >1.
all examples will help in the future.
Cheers
Chris.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-21-2007 08:48 PM
тАО05-21-2007 08:48 PM
Re: awk and else statements
If this is the case, there is no need to count them up. Just do:
/Virtual I\/O Bus/ { print serv ": virtual server"; exit}
END { print serv ": not a virtual server"}
You can also make it simpler by just using grep:
if [ $? -eq 0 ]; then
echo "$i: virtual server"
else
echo "$i: not a virtual server"
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-21-2007 08:51 PM
тАО05-21-2007 08:51 PM
Re: awk and else statements
I am pretty handy with shell scripting so I am attempting to learn awk / sed and later on perl ....
but thanks for the examples.
Chris
- « Previous
-
- 1
- 2
- Next »