- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: how to search for field in awk seperated by '/...
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
12-23-2004 02:24 PM
12-23-2004 02:24 PM
with awk you can search for field seperated by space, can I used it or any other method to search for field seperated by "/"..
e.g. /HOST1/HOST/2/HOST3
thanks!!
Henry
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2004 02:43 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2004 04:58 PM
12-23-2004 04:58 PM
Re: how to search for field in awk seperated by '/'
awk -F'
field seperator no need to be space, it can be anything
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2004 05:43 PM
12-23-2004 05:43 PM
Re: how to search for field in awk seperated by '/'
cut -d'/' -f3 yourfile
regards,
Thierry Poels.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2004 04:12 AM
12-24-2004 04:12 AM
Re: how to search for field in awk seperated by '/'
echo /HOST1/HOST/2/HOST3 | awk -F "/" '{ print $2 }'
Else you tr command to change / to ' ' to use awk as default :) as,
echo /HOST1/HOST/2/HOST3 | tr '/' ' ' | awk '{ print $2 }'
HTH.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2004 07:39 AM
12-27-2004 07:39 AM
Re: how to search for field in awk seperated by '/'
awk -F
An alternative way of denoting this is awk -F\/ '{print $2}'
Okay, it saves a grand total of ONE keystroke over awk -F "/" '{print $2}', but that is THE UNIX WAY!!!!!!!!!!!
[The \ is the "escape character", and tells awk that you really do want the next character, the / used as a character rather than as some form of another argument].
This comes in handy (and delightfully obscure) when using sed.
For example:
cat myfile|sed 's/\\/\//'
In sed speak, this means "swap literally the slash character (/) with literally the backslash character (\)".
Chris