DEV Community

Query Filter
Query Filter

Posted on

no perl

!/bin/bash

input="inputfile" # change to your input file
output="outputfile" # change to your output file

Convert file to hex, process to remove stray C2 not followed by AC, then convert back

xxd -p "$input" | tr -d '\n' | \
sed -E 's/(c2)(?!ac)/\1_removed_placeholder/gI' | \
sed -E 's/_removed_placeholder//g' | \
xxd -r -p > "$output"

Top comments (0)