Greeting,
I am trying to create a simple perl script to read a text file (8 columns
separated by space) and output the colume6,8.
The file format is:
Entry11 entry12 entry13 entry14 entry15 entry16 entry17 entry18
Entry21 entry22 entry23 entry24 entry25 entry26 entry27 entry28
..................
The script is following:
#!/usr/bin/perl -w
use perltext;
use strict;
use Fcntl ':flock'; # contains LOCK_EX (2) and LOCK_UN (8) constants
my $buffer;
my $file;
$file = $ARGV[0];
open(INFILE, $file);
# request an exclusive lock on the file.
flock(INFILE, LOCK_EX);
# read in each line from the file
while (<INFILE>)
{
#split out the fields in the line
@entry = split / /;
print "Entry: $entry[6] Entry: $entry[8]\n";
}
print "Entry6: $entry[6] Entry8: $entry[8]\n";
# unlock the file.
flock(INFILE, LOCK_UN);
close(INFILE);
the output I want is:
Entry: xxxxxx Entry: xxxxxx
Could anyone help me with this script since it can not get correct output?
Any comments will be appreciated
Thanks in advance
Julie
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]