The UNIX and Linux Forums  

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 -->
  #6 (permalink)  
Old 10-09-2008
otheus's Avatar
otheus otheus is offline Forum Staff  
Moderator ala Mode
  
 

Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 1,893
Absolutely. Are you looking for exactly one line, or more? Are the columns separated by whitespace? Assuming yes to all the answers above:

Code:
my $target;
if (open(FOO,$_)) { 
 while ($_=<FOO>) { 
   next unless /OXT/;  # find OXT anywhere in line.
   $target=(split)[4];
   last;
 }
 close(FOO); # forgot this last time, though not really necessary.
}
# 4th field in $target