- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- awk command
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
05-15-2001 05:09 AM
05-15-2001 05:09 AM
awk command
I would like to write a script that would extract the 5th field using the awk command from the lanscan command. Then I would like to take that field and send it to the ifconfig command and send the output to the screen. Can someone show me how its done please. I kinda know you would have to do something like lanscan > awk '/lan/'.... Thank you for all your assistance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2001 05:15 AM
05-15-2001 05:15 AM
Re: awk command
for X in `lanscan|awk 'NR>2 {print $5}'`
do
ifconfig $X
done
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2001 05:16 AM
05-15-2001 05:16 AM
Re: awk command
do
ifconfig ${i}
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2001 05:25 AM
05-15-2001 05:25 AM
Re: awk command
for I in `lanscan|grep lan|awk '{ print $5 }'
do
ifconfig $I
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2001 05:31 AM
05-15-2001 05:31 AM
Re: awk command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2001 05:36 AM
05-15-2001 05:36 AM
Re: awk command
The 'NR' variable is the current record count. 'awk' gives you this implicitly. Thus, I am selecting records from the output of the 'lanscan' where the record number is greater then two (2). As you know, this skips 'lanscan's headings.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2001 05:37 AM
05-15-2001 05:37 AM
Re: awk command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2001 05:40 AM
05-15-2001 05:40 AM
Re: awk command
Try this
lanscan | awk '{print $5}' | grep lan >/tmp/x
for i in 'cat /tmp/x'
do
ifconfig $i
done
Manoj Srivastava
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2001 10:02 AM
05-16-2001 10:02 AM
Re: awk command
lanscan | awk 'NR>2{system("ifconfig "$5)}'