This is going off of two assumptions, 1) that you want the task number to be
unique and 2) the fields are supposed to be tab delimited. If you want to
remove the dups from a different column then make that column as the key to
the hash. As for which fields, you can add and remove any column from the
value of the hash. Hope this helps.
 
 
open FILE, "file";
open OUT, ">outfile";
while (<FILE>) {
  chomp;
  next if /^SBLSRVR_NAME/; # ignore the first line.
  next if /^------------/; # ignore the second line.
  split /\t/,; # split each line and put it into @_.
  $hash{$_[4]} = qq[@_[4]\t@_[5]\t@_[8]\t@_[9]\t@_[10]]; # Assign parts of
@_ to %hash.
}
 
print OUT qq[$hash{$_}\n], for sort keys %hash; # Print your hash to the
outfile.
 

Patrick J Connolly 
 

 -----Original Message-----
From: Najamuddin, Junaid [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 24, 2001 11:47 AM
To: 'Wagner-David'
Cc: '[EMAIL PROTECTED]'
Subject: RE: Formatting text



Thanks
Attached is a text file which needs formatting
It has records with fields defined, but has some records repeated
I want to format this file and out put to another one with fields of my
choice and only one instance of each record
Thanks 

-----Original Message-----
From: Wagner-David [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 24, 2001 11:42 AM
To: 'Najamuddin, Junaid'
Subject: RE: Formatting text



        I am unsure what you are really after.  If you provided some input,
code snippet, etc so the list can see.  Along with how do you determine
which columns are to be bypassed, then you might get a response.

        At this point, it is very vague for most to do something with. 

Wags ;) 

-----Original Message----- 
From: Najamuddin, Junaid [ mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> ] 
Sent: Friday, August 24, 2001 09:06 
To: '[EMAIL PROTECTED]' 
Subject: Formatting text 


Thanks in advance 
How can we read a log text file which has columns and rows. 
The file has ten columns defined by a header/field name 
What i want is to out put into another text file but only the desired 
columns not all of them 
Some lines/records have duplicates so after this 
I want to sort them so that a record/line only apprears once 
can someone help me please. 
Oh, I am in NT environment 
Thanks again 

  


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 

Reply via email to