HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Awk field seperator
Operating System - Linux
1828328
Members
3433
Online
109976
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
Forums
Discussions
Discussions
Discussions
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
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
01-10-2007 11:30 PM
01-10-2007 11:30 PM
Re: Awk field seperator
Are these questions bulding up on one another? Does this new double match need to occur on the first line, or any line?
If it could be any line, then you need to read on until match or the END. If the END is reached, return other status:
awk '($1 ~ /^[0-9]+$/ && ($2 ~ /^[a-zA-Z0-9]+$/) {print; exit 0} END {exit 1}' tmp.txt
It's time to read that awk man page or book my friend!
hth,
Hein
If it could be any line, then you need to read on until match or the END. If the END is reached, return other status:
awk '($1 ~ /^[0-9]+$/ && ($2 ~ /^[a-zA-Z0-9]+$/) {print; exit 0} END {exit 1}' tmp.txt
It's time to read that awk man page or book my friend!
hth,
Hein
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2007 12:07 AM
01-11-2007 12:07 AM
Re: Awk field seperator
Hi,
to clarify the difference of Hein's solution to mine.
My solution aborts at the first line NOT containing twu fields, where the first consists of digits only.
Hein's solution terminates at the first correct entry with status 0; the return value is 1 when not a single correct field was found.
mfG Peter
to clarify the difference of Hein's solution to mine.
My solution aborts at the first line NOT containing twu fields, where the first consists of digits only.
Hein's solution terminates at the first correct entry with status 0; the return value is 1 when not a single correct field was found.
mfG Peter
The Universe is a pretty big place,
it's bigger than anything anyone has ever dreamed of before.
So if it's just us, seems like an awful waste of space, right?
Jodie Foster in "Contact"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2007 03:03 AM
01-11-2007 03:03 AM
Re: Awk field seperator
Not sure if i understand your requirement but based on your posts try the awk construct below:
# awk '/hell/ && !/awk/ {print (($3=="")?0:$3);exit}' file
~cheers
# awk '/hell/ && !/awk/ {print (($3=="")?0:$3);exit}' file
~cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2007 11:38 PM
01-11-2007 11:38 PM
Re: Awk field seperator
closed
- « Previous
-
- 1
- 2
- Next »
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.
Company
Support
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP