I wrote a bat file to capture some disk info and send it to a file. I got more info out of the function then i wanted but can not reduce the default output. The file looks like this:
LOGICAL UNIT NUMBER 1563
Default Owner: SP B
Current owner: SP A
Device Map: Valid
LOGICAL UNIT NUMBER 100
Default Owner: SP B
Current owner: SP A
Device Map: Valid
I have a lot of info about LUN's above 500 that I don't want. How do I read the file and delete the section of three lines having to do with LUN 1563? I tried a few ways and they all miss, so hoping someone has a better idea...
Dave
need help triming data out of a file
Moderator: DosItHelp
-
- Expert
- Posts: 80
- Joined: 04 Feb 2009 10:03
The only way I can see doing this is that during your capture of the data, you associate the LUN# with the associated lines, as in:
LOGICAL UNIT NUMBER 1563
LOGICAL UNIT NUMBER 1563 ~Default Owner: SP B
LOGICAL UNIT NUMBER 1563 ~Current Owner: SP A
LOGICAL UNIT NUMBER 1563 ~Device Map: Valid
Then you could scan the line for the LUN#, in this case 1563, and see if it's greater than 500 and if so, select lines that do NOT have the ~ in it and then select the lines that are less than 500, if that's your limit. You'll have to tweak it a couple of times, but you should be able to do it with that.
LOGICAL UNIT NUMBER 1563
LOGICAL UNIT NUMBER 1563 ~Default Owner: SP B
LOGICAL UNIT NUMBER 1563 ~Current Owner: SP A
LOGICAL UNIT NUMBER 1563 ~Device Map: Valid
Then you could scan the line for the LUN#, in this case 1563, and see if it's greater than 500 and if so, select lines that do NOT have the ~ in it and then select the lines that are less than 500, if that's your limit. You'll have to tweak it a couple of times, but you should be able to do it with that.