- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- combining some row of file 1 and file2 to third fi...
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
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
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
03-20-2014 09:37 AM
03-20-2014 09:37 AM
combining some row of file 1 and file2 to third file
Hi gurus ,
the first file , file 1 contains entries like :
\Hosts\HPUX\FINDBDR\10 information:
object
objectid .............................: 0A880710804301604165A50200C0000000005D00
objectname ...........................: \Hosts\HPUX\FINDBDR\10
objecttype ...........................: presentedunit
objectwwn ............................:
objecthexuid .........................: 6001-4380-02a5-6541-0000-c000-005d-0000
virtualdiskname ......................: \Virtual Disks\HPUX\COREDBDR10\ACTIVE
virtualdiskid ........................: 0A200710804301604165A50200C0000000005400
hostname .............................: \Hosts\HPUX\FINDBDR
hostid ...............................: 02800710804301604165A5020090000000000500
lunnumber ............................: 11
\Hosts\HPUX\FINDBDR\12 information:
object
objectid .............................: 2B880710804301604165A50200C0000000005E00
objectname ...........................: \Hosts\HPUX\FINDBDR\12
objecttype ...........................: presentedunit
objectwwn ............................:
objecthexuid .........................: 6001-4380-02a5-6541-0000-c000-005e-0000
virtualdiskname ......................: \Virtual Disks\HPUX\COREDBDR11\ACTIVE
virtualdiskid ........................: 27200710804301604165A50200C0000000005700
hostname .............................: \Hosts\HPUX\FINDBDR
hostid ...............................: 02800710804301604165A5020090000000000500
lunnumber ............................: 12
.....
The second file file2 , conatins entries like
:
\Virtual Disks\HPUX\COREDBDR10\ACTIVE information:
object
objectid .............................: 0A200710804301604165A50200C0000000005400
objectname ...........................: \Virtual Disks\HPUX\COREDBDR10\ACTIVE
objecttype ...........................: virtualdisk
objectwwn ............................:
objecthexuid .........................: 6001-4380-02a5-6541-0000-c000-0054-0000
partitionname ........................: ACTIVE
uid ..................................: 0A200710804301604165A50200C0000000005400
parentstoragecellinfo
storagecellname ....................: BDDREVA8100
storagecellid ......................: 0800071080430160B764A5020070000000000200
storagecellwwn .....................: 5000-1FE1-500F-4F70
objectparentuid ......................: 00000710804301604165A50200C0000000005300
objectparenthexuid ...................: 6001-4380-02a5-6541-0000-c000-0053-0000
objectparentid .......................: 00000710804301604165A50200C0000000005300
comments .............................:
creationdatetime .....................: 17-Jan-2011 15:35:27
timestampmodify ......................: 219118642
previousclonesourcevdiskid ...........: 0000000000000000000000000000000000000000
previousclonesourcevdiskhexuid .......: 0000-0000-0000-0000-0000-0000-0000-0000
familyname ...........................: COREDBDR10
wwlunid ..............................: 6001-4380-02a5-6541-0000-c000-0054-0000
dirtyblockcount ......................: 0
onlinecontroller
controllername .....................: Controller A
controllerid .......................: 0000070880430150B764A5020000000000000000
operationalstate .....................: good
operationalstatedetail ...............: operating_normally
allocatedcapacity ....................: 150
...
I am trying to create a third file , file3 from combining some of entires above like
Objectname(from file1): virtualdiskname(common in file 1 and file 2):wwlunid(file2):creationdatetime(file2):operationalstate(file2):allocatedcapacity(file2)
I tried a combination of grep and awk , but that didn’t worked out.
Appricate your help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2014 11:20 AM
03-20-2014 11:20 AM
Re: combining some rows of file1 and file2 to third file
>I am trying to create a third file, file3 from combining some of entries
Basically in awk you read in file1 and save the entries you want to keep in arrays.
Then you read in file2 and match them up and print them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2014 09:28 PM
03-20-2014 09:28 PM
Re: combining some row of file 1 and file2 to third file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2014 11:10 PM
03-20-2014 11:10 PM
Re: combining some row of file 1 and file2 to third file
Here is an example of how to read one file in awk and put into an array, then read the rest of the files and check the array: