Hi,
First query:
I am trying to execute the below command to pull all the record whose length is not of the expected. But this is not giving the expected results.
$2 is the record length passed in the script as second parameter.$filename is the filename on which the awk is executed.It is returning all the records irrespective of criteria. Please advise.
awk -v xx=$2 'length!=$xx' $filename
Second query:
In an flat file, some of the records are not of the fixed length.This is due to presence of null character and junk characters.If record length is expected to be 100..due to presence of these characters it is varying to be 102-105. when executing the awk command with length function to pull the records whose length isnt matching...for those records which have null character..the record displayed on standard output is only till null character.The subsequent fields after null character is not returned by awk.Please explain why this would happen and what is the solution to retain entire record.
Also suggest a command to identify the null characters and replace by a space or any solution to fix these junk or null characters..so that we can have a complete file whose length isnt deviating from expected length..Thanks!