Nov 21, 2011, 8:29 AM
Post #1 of 1
Alright so here is what I'm trying to do, and what I have so far.
Split input .dat files based on first 16 chars HELP
# Read a file and write out the same file with transformations
# 1) Change filename of input to filename-subname on output.
# 2) Each record in the input file will have a 16 character subname
# 3) The same record in the output will have the 16 characters removed
# 4) One or more output files will be created based on how many unique subnames are on the input records
# 5) Input records are not sorted by subname
($name,$path,$suffix) = fileparse($fullname,@suffixlist);
$name = fileparse($fullname,@suffixlist);
$basename = basename($fullname,@suffixlist);
$dirname = dirname($fullname);
my($line) = $_;
#strip trailing newline from the line
#set the line to the first 16 characters
$line = substr($_ 0, 16);
my($subname) = $line;
Just tried to run it received this error:
Missing comma after first argument to substr function at subNameTransform1.pl line 44, near "16)".
Can someone please help me get this working? I'm really terrible with perl, your help would be greatly appreciated.