Search code examples
bashoutputsymbols

How to remove "clear-screen" symbol from command output?


I connect via ssh to server and use the ffprobe command to get specific data about video and audio streams from a media file on putty window, but in the result output there is a symbol clear-screen, ( Ctrl+L, ^L ), and clear terminal screen. If redirect output to a file, and open in mcedit, it looks like this:

TAG:handler_name=^LVideoHardler

Running through xxd, the line looks like:

00000000: 5441 473a 6861 6e64 6c65 725f 6e61 6d65  TAG:handler_name
00000010: 3d0c 5669 6465 6f48 616e 646c 6572 0a    =.VideoHandler.

Is there any way to escape or remove this character from the output? Or save the output to a file and remove it already from the file?

thx


Solution

  • ^L, per https://en.wikipedia.org/wiki/ASCII, is a form-feed (this can also be validated because the xxd output contains 0c, which in decimal is ASCII character 12). To remove it with tr, you'd use the ANSI C escape sequence, which is \f.

    Thus:

    ffprobe ... | tr -d '\f' >file
    

    ...should store content in your output file with the unwanted character removed.