#!/usr/bin/perl use warnings; $input_data = @ARGV[0]; $output_data = @ARGV[1]; $h2_flag = 0; $h3_flag = 0; open(INFILE,"$input_data") || die "cannot open input file : $infile"; open(OUTFILE,">$output_data") || die "cannot open temporary output file : $output_data"; $/=undef; # Process error data to rectify the error records in massaged data while () { $data = $1; if ($data =~ m/(.*)/) { $h2_flag++; }elsif ($data =~ m/(.*)/) { $h3_flag++; } if ($h2_flag == 1) { if ($data =~ m/(.*)/) { $head_data = $1; $head_data =~ s/.*)/) { $head_data = $1; $Case_No = $head_data = s/(<.*>)(.*)/$2/; $Case_No = $head_data; $date = $head_data; $h2_flag = 0; }elsif ($h3_flag == 1) { print "PRINT"; $h3_flag = 0; } } print OUTFILE $_; # Output the contents of $_ to # output file } # Close the INFILE and OUTFILE. close(INFILE); close(OUTFILE); #### Hi, This is the sample of the data: T.G No. L-5786 December 29, 2010 ASIAN vs. ET AL. Sample output on should be all special character will be remove. and the date will be converted as 12292010. Output: TGNL5786Y12292010 Description: TGNL5786 - Head Y - Consistent Indicator of date. Date - 12292010 December will be 12 Date is 29 and Year is 2010. the month word will always be converted into its numeric value. January - 01