I have a database controlfile on a Linux system that I want to filter out (for training purposes). However, I am unable to find a proper way to get rid of "block-like" characters:
▒▒▒▒
▒▒▒▒
▒▒▒▒
▒▒▒▒▒
▒▒▒{
▒▒▒▒▒▒9
▒▒▒▒
▒▒▒▒▒
I've tried many ways, but they do not get rid of the block chars:
258 strings o1_mf_d3rrgv0l_.ctl|grep -vE '▒'
259 strings o1_mf_d3rrgv0l_.ctl|grep -vE '@|?|+|(|)|<|>'
260 strings o1_mf_d3rrgv0l_.ctl|grep -vE '@|\?|\+|(|)|<|>'
261 strings o1_mf_d3rrgv0l_.ctl|grep -vE '@|\?|\+|\(|\)|\<|\>'
262 strings o1_mf_d3rrgv0l_.ctl|grep -vE '@|\?|\+|\(|\)|\<|\>|!'
263 strings o1_mf_d3rrgv0l_.ctl|grep -vE '@|\?|\+|\(|\)|\<|\>|!|\^|\%|\`'
264 strings o1_mf_d3rrgv0l_.ctl|grep -vE '@|\?|\+|\(|\)|\<|\>|!|\^|\%|\`|\$'
265 strings o1_mf_d3rrgv0l_.ctl|grep -v '[^[:print:]]'
266 strings o1_mf_d3rrgv0l_.ctl|grep -v '[[:print:]]'
267 strings o1_mf_d3rrgv0l_.ctl|grep '[[:print:]]'
268 strings o1_mf_d3rrgv0l_.ctl|grep -v '[[:cntrl:]]'
269 strings o1_mf_d3rrgv0l_.ctl|grep -v '\x{09}'
270 strings o1_mf_d3rrgv0l_.ctl|grep -vP '[^\x00-\x7f]'
271 strings o1_mf_d3rrgv0l_.ctl|tr -dc '\007-\011\012-\015\040-\376'
272 strings -1 o1_mf_d3rrgv0l_.ctl|tr -dc '\007-\011\012-\015\040-\376'
273 strings o1_mf_d3rrgv0l_.ctl|tr -dc '[:print:]\n\r'
274 strings o1_mf_d3rrgv0l_.ctl|grep -vE '@|\?|\+|\(|\)|\<|\>|!|\^|\%|\`|\$'
275 strings o1_mf_d3rrgv0l_.ctl|grep -vE '@|\?|\+|\(|\)|\<|\>|!|\^|\%|\`|\;|\:|\=|\$'
276 strings o1_mf_d3rrgv0l_.ctl|grep -vE '@|\?|\+|\(|\)|\<|\>|!|\^|\%|\`|\;|\:|\=|\$|\"'
277 strings o1_mf_d3rrgv0l_.ctl|grep -vE '@|\?|\+|\(|\)|\<|\>|!|\^|\%|\`|\;|\:|\=|\$|\"|\&|\#'
grep -v
is not the right tool, as it removes entire lines that contain the regular expression. You could trytr
as shown at unix.stackexchange.com/questions/201751/…, followed bysed
. Or start withcat -v
, which represents non-printable characters like ^A, then also filter them out withsed
. The problem withcat -v
is that it doesn't distinguish between a^
character and an unprintable character. I am sure there are other solutions.