The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 02-16-2008
netmedic netmedic is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 12
AWK Problem Need Help!

I have a problem that I have not be able to get solved. First of all the script I am writing is for a Windows server. I am trying to write a script that will connect to a ISCSI SAN and locate the last Snapshot for that server and mount it for a backup. In order to capture the screens I have been redirecting the output to a text file then using CYGWIN and GAWK to parse the file and extract the information I need to pass into another file which is named a bat file which is executed for the next step. I have everything working except the last critical step. When I connect to the snapshot the volume does not mount with a drive letter. When I run a diskpart I can see the disk number (without a letter). I then need to run a few diskpart commands to connect to the volume before I can assign a letter of my choice.

Now for the issue. The output of the file is a follows:

Volume 0<sp> Data NTFS Partition 400 GB Healthy
Volume 1 Z <sp><sp> DVD-ROM 0 GB Healthy
Volume 2 C <sp> NTFS Partition 21 GB Healthy System
Volume 3 D Data1 NTFS Partition 115 GB Healthy
(<sp> is there only to indicate there is a blank space)

What I need to do is extract the line that does not have a drive letter. I would like to use awk for this. The problem is that this line is not always the first line nor Volume 0. The only thing that is constant is that is will not have a drive letter. When I try a $3 for the third field it treats the word Data as the third field since its blank. I was hopeing something like

$3 // { print $1, $2 }

Can any one help?