How to pull info under headers in file(awk,grep,while loop)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to pull info under headers in file(awk,grep,while loop)
Prev   Next
# 1  
Old 01-04-2010
How to pull info under headers in file(awk,grep,while loop)

below is an extract from my file and I am trying to use Awk and grep and a while loop to pull infomation from under neath "HBA WWN=".HBA WWN=" reoccurs all over the file but the 100000c.....number are unique and I want to be able to pull and reference specifi information under this header ever time and New "HBA WWN=" is reached. Hope this makes sense.

Code:
HBA WWN = 10000000c988d499
Symmetrix ID        : 000190104790
Originator Port wwn : 10000000c988d499
User-generated Name : 10000000c988d499/10000000c988d499
Sym Dev                                               LUN
Name    Dir:P  Physical Device Name     VBUS  TID  SYMM HOST  Attr  Cap(MB)
------  -----  -----------------------  ----  ---  ---- ----  ----  -------
113E     3D:0  Not Visible                 0    0    4c  N/A          17263
18BA     3D:0  Not Visible                 0    0    4d  N/A           8632
1A87     3D:0  Not Visible                 0    0    4e  N/A           4314
1C22     3D:0  Not Visible                 0    0    47  N/A  (M)    155368
1FB4     3D:0  Not Visible                 0    0    4f  N/A           4314
1FB5     3D:0  Not Visible                 0    0    50  N/A           4314
1FB6     3D:0  Not Visible                 0    0    51  N/A           4314
1FB7     3D:0  Not Visible                 0    0    48  N/A  (M)      8629
20C3     3D:0  Not Visible                 0    0    40  N/A  (M)    491400
20CB     3D:0  Not Visible                 0    0    41  N/A  (M)    491400
20DB     3D:0  Not Visible                 0    0    46  N/A  (M)    491400
228F     3D:0  Not Visible                 0    0    66  N/A  (M)    103545
293E     3D:0  Not Visible                 0    0    67  N/A  (M)    103579
2CA3     3D:0  Not Visible                 0    0    49  N/A  (M)     86316
2CA8     3D:0  Not Visible                 0    0    4a  N/A  (M)     86316
2CAD     3D:0  Not Visible                 0    0    4b  N/A  (M)     34526
2D9A     3D:0  Not Visible                 0    0    65  N/A  (M)     69053
2DAE     3D:0  Not Visible                 0    0    68  N/A  (M)     86316
2DB8     3D:0  Not Visible                 0    0    69  N/A  (M)    207158
2DD0     3D:0  Not Visible                 0    0    6a  N/A  (M)     51789
2F1C     3D:0  Not Visible                 0    0    42  N/A  (M)      8629
2F1E     3D:0  Not Visible                 0    0    43  N/A  (M)     21572
2F23     3D:0  Not Visible                 0    0    44  N/A  (M)     30201
2F2A     3D:0  Not Visible                 0    0    45  N/A  (M)     21572
2F3B     3D:0  Not Visible                 0    0    6b  N/A  (M)      8629
2F3D     3D:0  Not Visible                 0    0    6c  N/A  (M)      8629
2F3F     3D:0  Not Visible                 0    0    6d  N/A  (M)      8629
2F41     3D:0  Not Visible                 0    0    6e  N/A  (M)      8629
326C     3D:0  Not Visible                 0    0    6f  N/A  (M)    491400
3274     3D:0  Not Visible                 0    0    70  N/A  (M)    491400
327C     3D:0  Not Visible                 0    0    71  N/A  (M)    491400
3284     3D:0  Not Visible                 0    0    72  N/A  (M)    491400
328C     3D:0  Not Visible                 0    0    73  N/A  (M)    491400
HBA WWN = 10000000c952efb6
Symmetrix ID        : 000190104790
Originator Port wwn : 10000000c952efb6
User-generated Name : 10000000c952efb6/10000000c952efb6
Sym Dev                                               LUN
Name    Dir:P  Physical Device Name     VBUS  TID  SYMM HOST  Attr  Cap(MB)
------  -----  -----------------------  ----  ---  ---- ----  ----  -------
161E    14D:1  Not Visible                 0    0    52  N/A           1080
161F    14D:1  Not Visible                 0    0    53  N/A           1080
1620    14D:1  Not Visible                 0    0    54  N/A           1080
1621    14D:1  Not Visible                 0    0    55  N/A           1080
198D    14D:1  Not Visible                 0    0    56  N/A           8632
1C46    14D:1  Not Visible                 0    0    57  N/A  (M)     17263
1C48    14D:1  Not Visible                 0    0    58  N/A  (M)     17263
1C4A    14D:1  Not Visible                 0    0    59  N/A  (M)     17263
1C4C    14D:1  Not Visible                 0    0    5a  N/A  (M)     25895
1FB9    14D:1  Not Visible                 0    0    5b  N/A  (M)      8629
2BDF    14D:1  Not Visible                 0    0    5c  N/A  (M)    207158
2BEB    14D:1  Not Visible                 0    0    5d  N/A  (M)     51789
2BF6    14D:1  Not Visible                 0    0    5e  N/A  (M)     17263
2CAF    14D:1  Not Visible                 0    0    5f  N/A  (M)     69053
2D5C    14D:1  Not Visible                 0    0    60  N/A  (M)     17263
2D5E    14D:1  Not Visible                 0    0    61  N/A  (M)     17263
2D60    14D:1  Not Visible                 0    0    62  N/A           8632
2D61    14D:1  Not Visible                 0    0    63  N/A           8632
2D62    14D:1  Not Visible                 0    0    64  N/A           8632
HBA WWN = 10000000c9446de8
Symmetrix ID        : 000190104790
Originator Port wwn : 10000000c9446de8
User-generated Name : 10000000c9446de8/10000000c9446de8
Sym Dev                                               LUN
Name    Dir:P  Physical Device Name     VBUS  TID  SYMM HOST  Attr  Cap(MB)
------  -----  -----------------------  ----  ---  ---- ----  ----  -------
161E    14D:1  Not Visible                 0    0    52  N/A           1080
161F    14D:1  Not Visible                 0    0    53  N/A           1080
1620    14D:1  Not Visible                 0    0    54  N/A           1080
1621    14D:1  Not Visible                 0    0    55  N/A           1080
198D    14D:1  Not Visible                 0    0    56  N/A           8632
1C46    14D:1  Not Visible                 0    0    57  N/A  (M)     17263
1C48    14D:1  Not Visible                 0    0    58  N/A  (M)     17263
1C4A    14D:1  Not Visible                 0    0    59  N/A  (M)     17263
1C4C    14D:1  Not Visible                 0    0    5a  N/A  (M)     25895
1FB9    14D:1  Not Visible                 0    0    5b  N/A  (M)      8629
2BDF    14D:1  Not Visible                 0    0    5c  N/A  (M)    207158
2BEB    14D:1  Not Visible                 0    0    5d  N/A  (M)     51789
2BF6    14D:1  Not Visible                 0    0    5e  N/A  (M)     17263
2CAF    14D:1  Not Visible                 0    0    5f  N/A  (M)     69053
2D5C    14D:1  Not Visible                 0    0    60  N/A  (M)     17263
2D5E    14D:1  Not Visible                 0    0    61  N/A  (M)     17263
2D60    14D:1  Not Visible                 0    0    62  N/A           8632
2D61    14D:1  Not Visible                 0    0    63  N/A           8632
2D62    14D:1  Not Visible                 0    0    64  N/A           8632


Last edited by Scott; 01-04-2010 at 07:29 PM.. Reason: Please use code tags
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep/awk part of info of a column

I have a question that I am at a loss to solve. I have 3 column tab-separated data, such as: abs nmod+n+n-commitment-n 349.200023 abs nmod+n+n-a-commitment-n 333.306429 abs into+ns-j+vn-pass-rb-divide-v 295.57316 abs nmod+n+ns-commitment-n 182.085018 abs nmod+n+n-pledge-n ... (2 Replies)
Discussion started by: owwow14
2 Replies

2. UNIX for Dummies Questions & Answers

Pull out multiple lines with grep patternfile

Hi, I'm trying to get lines from a file using identifiers in the first two columns. I have used: cat MasterFile.txt | grep -f Pattern.txt and the lines I want display on screen. If I try to put them in a file the file is created but stays empty: cat MasterFile.txt | grep -f Pattern.txt... (14 Replies)
Discussion started by: FGPonce
14 Replies

3. Shell Programming and Scripting

Script to loop line in a file and add info or do echo

I have a record.txt it will update weekly, and it could be 2 lines or more ... it just echo each line to the script san jose,23.34% tampa,2.15% dallas,30.20% seattle,44.29% Unknown,16.72% How do i write a shell script to give me a test.pl or bash file which contain #!/home/perl... (8 Replies)
Discussion started by: sabercats
8 Replies

4. Shell Programming and Scripting

Remove interspersed headers in .dat file with AWK

Heya there, A small selection of my data is shown below. DATE TIME FRAC_DAYS_SINCE_JAN1 2011-06-25 08:03:20.000 175.33564815 2011-06-25 08:03:25.000 175.33570602 2011-06-25 ... (4 Replies)
Discussion started by: gd9629
4 Replies

5. Shell Programming and Scripting

Cat 114 files using grep or awk to pull muliple fields

Files xxxxxxx.txt ------------------------------------------------------------------------------------------------------------------------------------ Req.By: xxxxxxx WABUSH MINES - xxxxxx MINE (1001) Page: 1 Run on: 12/14/09... (4 Replies)
Discussion started by: sctxms
4 Replies

6. UNIX for Dummies Questions & Answers

Grep Headers

Hi! Trying to find string and then put the above Headers of corresponding fist line. After executing a Property command a get this output: SP/CH-CH Span Name Type TG Idle InUse OffHk OnHk Ring -------- ------------------------------ ------ ---- ----- ----- ----- 02/01-24 CARRIERSS7... (6 Replies)
Discussion started by: Joel_john
6 Replies

7. Shell Programming and Scripting

Merging of files with different headers to make combined headers file

Hi , I have a typical situation. I have 4 files and with different headers (number of headers is varible ). I need to make such a merged file which will have headers combined from all files (comman coluns should appear once only). For example - File 1 H1|H2|H3|H4 11|12|13|14 21|22|23|23... (1 Reply)
Discussion started by: marut_ashu
1 Replies

8. Shell Programming and Scripting

script to pull info from my email?

Hi, I need help writing a script that would pull info from an email inbox and add it to an Evolution Calendar. I'm pretty sure I can google the commands to add the info to the calendar. The part that I really need help with is getting the info from the email into the command. Basically for... (6 Replies)
Discussion started by: xinix
6 Replies

9. UNIX for Dummies Questions & Answers

Using awk (or whatever) to pull and append data in a new file

One of the fortunate things about posting in a "Dummies" forum is you probably aren't expecting a lot of out me... I'm trying to pull fields from two lines in the same file(s), and then append them together in a new file. So...I get a nice line-by-line of the first bit of data I'm looking... (6 Replies)
Discussion started by: Milano_EH3
6 Replies

10. Shell Programming and Scripting

trying to write a script to loop through a port info file

Below is part of a script i have written to loop through part of a port info file. How do i continue the script to get info for OS Device Name, manufacturer and then put information into an array? HBA Port WWN: 10000000c9420b4b OS Device Name: /dev/cfg/c10 Manufacturer: Emulex... (5 Replies)
Discussion started by: rcon1
5 Replies
Login or Register to Ask a Question