#! /bin/awk -f # #------------------------------------------------------------------------------ # this awk script is used to read SYSOUT files and break the input lines into # separate lines when a form feed character (x'0C') is embedded in the input # line, as in the case where two logical lines are written onto a single # physical line in the input file. # # Syntax: awk -f formfeed.awk [sysout file] >[corrected sysout file] #------------------------------------------------------------------------------ # #------------------------------------------------------------------------------ # the BEGIN function is used to create a "separator" line, which will be # printed whenever a form feed character is encountered in the input stream #------------------------------------------------------------------------------ BEGIN { for (c = 1; c < 121; c++) { pageline = pageline "=";}; } # end pattern # #------------------------------------------------------------------------------ # for all records in the input stream - # if there is no formfeed charcter in the record, print the record # if there is a formfeed at the front of the record, remove it # if there is an embedded formfeed, # print the portion of the record to the left of the formfeed # set the record to the portion of the record to the right of the formfeed #------------------------------------------------------------------------------ { line = $0; # copy the input record to "line" while (1 == 1) { # loop processing "line" until "break" flag = index(line, "\f"); # set "flag" to position of formfeed if (flag == 0) { # if no formfeed in record print line; # print record break; # exit "while" to process next record } # end if if (flag == 1) { # if formfeed is 1st character line = substr(line, 2); # remove formfeed from record } # end if else { print substr(line, 1, (flag - 1)); # print portion left of formfeed print pageline; # print page separator line line = substr(line, flag); # get portion right of formfeed } # end else } # end while } # end pattern