perl -lane 'next if($F[2]=~/5.5/);print' your_file
if the third column has 5.5, then this row will be deleted. But if the third column is 5.52 or 15.53, then with the above command they will be deleted. Therefore, if you want to delete a line only if it has an exact exact match, use below:
perl -lane 'next if($F[2]=~/\b5.5\b/);print' your_file
checked below:
> cat temp Value Value1 value2 5 1 2 1 4 3 2 1 5.51 2 1 5.5 0 0 0 4 1 0 >
Using the first command:
> perl -lane 'next if($F[2]=~/5.5/);print' temp Value Value1 value2 5 1 2 1 4 3 0 0 0 4 1 0 >
With the second command:
> perl -lane 'next if($F[2]=~/\b5.5\b/);print' temp Value Value1 value2 5 1 2 1 4 3 2 1 5.51 0 0 0 4 1 0 >
source share