Search string and parse


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Search string and parse
# 1  
Old 05-02-2011
Search string and parse

Input file

Code:
 
0792 to 2450 iadmssql7: 
    Copy: 
      CNJ R1: 
        Replication volumes: 
          Replication set: RSet 1
          Replication size: 200.00GB
          SAN Info: 
            200.00GB  DGC  VRAID  CX4-960  LUN 17 (17)  
            RPA Port      WWN        Ctrl   Serial          LUN               
            -------------------------------------------------------
             1   0  500601603b206fe3 SP-A   APM00104000792   80                
             1   0  500601693b206fe3 SP-B   APM00104000792   80                
             1   2  500601613b206fe3 SP-A   APM00104000792   80                
             1   2  500601683b206fe3 SP-B   APM00104000792   80                
             2   0  500601603b206fe3 SP-A   APM00104000792   80                
             2   0  500601693b206fe3 SP-B   APM00104000792   80                
             2   2  500601613b206fe3 SP-A   APM00104000792   80                
 
 
          Replication set: RSet 2
          Replication size: 102.00GB
          SAN Info: 
            102.00GB  DGC  VRAID  CX4-960  LUN 133 (133)  
            RPA Port      WWN        Ctrl   Serial          LUN               
            -------------------------------------------------------
             1   0  500601603b206fe3 SP-A   APM00104000792   81                
             1   0  500601693b206fe3 SP-B   APM00104000792   81                
             1   2  500601613b206fe3 SP-A   APM00104000792   81                
             1   2  500601683b206fe3 SP-B   APM00104000792   81                
             2   0  500601603b206fe3 SP-A   APM00104000792   81                
             2   0  500601693b206fe3 SP-B   APM00104000792   81                
             2   2  500601613b206fe3 SP-A   APM00104000792   81                
 
        Journal volumes: 
          SAN Info: 
            20.00GB  DGC  VRAID  CX4-960  LUN 3016 (3016)  
            RPA Port      WWN        Ctrl   Serial          LUN               
            -------------------------------------------------------
             1   0  500601603b206fe3 SP-A   APM00104000792   28                
             1   0  500601693b206fe3 SP-B   APM00104000792   28                
             1   2  500601613b206fe3 SP-A   APM00104000792   28                
             1   2  500601683b206fe3 SP-B   APM00104000792   28                
             2   0  500601603b206fe3 SP-A   APM00104000792   28                
             2   0  500601693b206fe3 SP-B   APM00104000792   28                
 
      CNJ R2: 
        Replication volumes: 
          Replication set: RSet 1
          Replication size: 200.00GB
          SAN Info: 
            200.00GB  DGC  VRAID  CX4-960  LUN 1017 (17)  3  
            RPA Port      WWN        Ctrl   Serial          LUN               
            -------------------------------------------------------
             1   0  500601603ca01347 SP-A   APM00105002450   55                
             1   0  500601633ca01347 SP-A   APM00105002450   55                
             1   0  500601693ca01347 SP-B   APM00105002450   55                
             1   0  5006016a3ca01347 SP-B   APM00105002450   55                
             1   1  500601603ca01347 SP-A   APM00105002450   55                
             1   1  500601633ca01347 SP-A   APM00105002450   55                
 
 
          Replication set: RSet 2
          Replication size: 102.00GB
          SAN Info: 
            102.00GB  DGC  VRAID  CX4-960  LUN 1033 (133)  
            RPA Port      WWN        Ctrl   Serial          LUN               
            -------------------------------------------------------
             1   0  500601603ca01347 SP-A   APM00105002450   56                
             1   0  500601633ca01347 SP-A   APM00105002450   56                
             1   0  500601693ca01347 SP-B   APM00105002450   56                
             1   0  5006016a3ca01347 SP-B   APM00105002450   56                
             1   1  500601603ca01347 SP-A   APM00105002450   56                
 
 
        Journal volumes: 
          SAN Info: 
            20.00GB  DGC  VRAID  CX4-960  LUN 3013 (3013)  
            RPA Port      WWN        Ctrl   Serial          LUN               
            -------------------------------------------------------
             1   0  500601603ca01347 SP-A   APM00105002450   6                 
             1   0  500601633ca01347 SP-A   APM00105002450   6                 
             1   0  500601693ca01347 SP-B   APM00105002450   6                 
             1   0  5006016a3ca01347 SP-B   APM00105002450   6                 
             1   1  500601603ca01347 SP-A   APM00105002450   6                 
             1   1  500601633ca01347 SP-A   APM00105002450   6    
 
 0792 to 2450 ifserver: 
    Copy: 
      CNJ R1: 
        Replication volumes: 
          Replication set: RSet 1
          Replication size: 60.00GB
          SAN Info: 
            60.00GB  DGC  VRAID  CX4-960  LUN 257 (257)  60,06,01,60,42,84,1e,00,2a,e4,cb,d6,4d,6f,e0,11 0x63d60519133f0bf4  
            RPA Port      WWN        Ctrl   Serial          LUN               
            -------------------------------------------------------
             1   0  500601603b206fe3 SP-A   APM00104000792   82                
             1   0  500601693b206fe3 SP-B   APM00104000792   82

Code:
0792 to 2450 iadmssql7,RSet 1,200.00GB,LUN 17,APM00104000792,LUN 1017,APM00105002450
0792 to 2450 iadmssql7,RSet 2,102.00GB,LUN 133,APM00104000792,LUN 1033,APM00105002450
 0792 to 2450 iadmssql7,Journal,20:00GB,LUN 3016,APM00104000792
 0792 to 2450 iadmssql7,Journal,20:00GB,LUN 3013,APM00105002450

File has more records and fields similar to above format , I want to get the above formated output based on a search string . My Search string is "0792 to 2450 iadmssql7:" Lines are combined based on common strings in sub records

Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to use a grep search to search for a specific string within multiple directories?

Lets say I have a massive directory which is filled with other directories all filled with different c++ scripts and I want a listing of all the scripts that contain the string: "this string". Is there a way to use a grep search for that? I tried: grep -lr "this string" * but I do not... (3 Replies)
Discussion started by: Circuits
3 Replies

2. Shell Programming and Scripting

Search string within a file and list common words from the line having the search string

Hi, Need your help for this scripting issue I have. I am not really good at this, so seeking your help. I have a file looking similar to this: Hello, i am human and name=ABCD. How are you? Hello, i am human and name=PQRS. I am good. Hello, i am human and name=ABCD. Good bye. Hello, i... (12 Replies)
Discussion started by: royzlife
12 Replies

3. Shell Programming and Scripting

Search several string and convert into a single line for each search string using awk command AIX?.

I need to search the file using strings "Request Type" , " Request Method" , "Response Type" and by using result set find the xml tags and convert into a single line?. below are the scenarios. Cat test Nov 10, 2012 5:17:53 AM INFO: Request Type Line 1.... (5 Replies)
Discussion started by: laknar
5 Replies

4. Shell Programming and Scripting

parse a mixed alphanumeric string from within a string

Hi, I would like to be able to parse out a substring matching a basic pattern, which is a character followed by 3 or 4 digits (for example S1234 out of a larger string). The main string would just be a filename, like Thisis__the FileName_S1234_ToParse.txt. The filename isn't fixed, but the... (2 Replies)
Discussion started by: keaneMB
2 Replies

5. Shell Programming and Scripting

Parse string

Hi, I need to parse a string, check if there are periods and strip the string. For example i have the following domains and subdomains: mydomain.com, dev.mydomain.com I need to strip all periods so i have a string without periods or domain extensions: mydomain, devmydomain. I use this for... (12 Replies)
Discussion started by: ktm
12 Replies

6. Shell Programming and Scripting

Parse String Using Sed

Hi, I am wondering if there's a simpler way to extract the second occurrence of a word enclosed in that matches my search criteria. Sample Input is as follows: Error installing feature - com.er.nms.cif.ist.NoMatchingUpgra Error installing feature -... (4 Replies)
Discussion started by: racbern
4 Replies

7. Shell Programming and Scripting

how to parse this string

I want to get filenames from the following input. How can I parse this in bash. input data ------------------------------------------------------------------- path=/aaa/bbb/filename1;/aaa/filename2;/aaa/bbb/ccc/ddd/filename3 -------------------------------------------------------------------... (13 Replies)
Discussion started by: hcliff
13 Replies

8. Shell Programming and Scripting

Perl: Search for string on line then search and replace text

Hi All, I have a file that I need to be able to find a pattern match on a line, search that line for a text pattern, and replace that text. An example of 4 lines in my file is: 1. MatchText_randomNumberOfText moreData ReplaceMe moreData 2. MatchText_randomNumberOfText moreData moreData... (4 Replies)
Discussion started by: Crypto
4 Replies

9. UNIX for Dummies Questions & Answers

Search and Parse string from inside a File

Hello, I barely know the basics, but I am very determined to learn. I want to parse a few characters from each row, use that string to search another file and display the line number where I found the value in the file. I don't know if this can all be done on the command line, so I am creating a... (2 Replies)
Discussion started by: SSims
2 Replies

10. Shell Programming and Scripting

Perl: Search for string then parse next line

Hi All, I have a file that I need to be able to find a pattern match on one line then parse data on the next or subsequent lines - I will know which line needs to be parsed beforehand. This is what I currently have: while (<COMMAND_OUT>) { if ($_ =~ m/TEST/) { ... (4 Replies)
Discussion started by: pondlife
4 Replies
Login or Register to Ask a Question