- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Process multi-line input w/awk?
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
11-06-2001 07:25 AM
11-06-2001 07:25 AM
Pete
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2001 07:36 AM
11-06-2001 07:36 AM
Re: Process multi-line input w/awk?
the following will join the lines:
ed ioscan.tmp << [EOT]
,g/^disk/.,.+1j
w
q
[EOT]
formatting output afterwards should be piece of cake ;)
good luck,
Thierry.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2001 07:37 AM
11-06-2001 07:37 AM
Re: Process multi-line input w/awk?
http://www.cs.ruu.nl/docs/vakken/st/nawk/nawk_25.html#SEC28
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2001 07:48 AM
11-06-2001 07:48 AM
Re: Process multi-line input w/awk?
You could do something like this:
# ioscan -kfnC disk|awk 'A=$1;B=$3;C=$7;D=$8;getline;E=$1;F=$2;print A,B,C,D,E,F}'
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2001 07:59 AM
11-06-2001 07:59 AM
Re: Process multi-line input w/awk?
-F (note upper case) to ioscan
the output looks like this:
scsi:wsio:T:T:F:31:188:4096:disk:sdisk:0/0/1/0.1.0:5 128 2 2 0 0 0 0 90 114 96 2
55 0 0 0 0 :2:root.sba.lba.c720.tgt.sdisk:sdisk:CLAIMED:DEVICE:HP DVD-ROM 3
05:0
/dev/dsk/c0t1d0 /dev/rdsk/c0t1d0
then just use the awk command -F:
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2001 08:01 AM
11-06-2001 08:01 AM
SolutionThis should work for all devices, not just disks:
======================================
#!/bin/ksh
ioscan -fn|
awk '/^Class/{printf ("%-10s%-4s%-8s%-30sDevice File\n",$1,$3,$4,$NF)}
/^\=/{printf("%s",$0)}
/CLAIMED/{printf ("\n%-10s%-12s",$1,$3);
DESC="";for (i=7;i<=NF;i++){DESC=DESC" "$i};
printf("%-30s",DESC)}
/dev/{printf("%-20s",$1)}
END{print}'
=========================================
Rgds, Robin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2001 08:02 AM
11-06-2001 08:02 AM
Re: Process multi-line input w/awk?
ioscan -C disk -kfnF | awk -F: 'scripthere'
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2001 08:03 AM
11-06-2001 08:03 AM
Re: Process multi-line input w/awk?
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2001 08:06 AM
11-06-2001 08:06 AM
Re: Process multi-line input w/awk?
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2001 08:17 AM
11-06-2001 08:17 AM
Re: Process multi-line input w/awk?
I *knew* Robin would have the best answer if he were reading this! ;-)
Regards!
...JRF...