Tr command

I am doing a reverse Engg on one of the application built in Unix Shell to replicate the same in a different technology.

I do not have the flexibility to run the commands/query the file data in that server. So asking..

tr -dc '\001-\010\011-\015\030-\200' < abc.txt > xyz.txt

I understand the command "tr -dc ". But I didnt understand how it works for range of numbers.

What will be the result of this command?

Can anyone help me with this command.

looks like its deleting (-d) (some) control characters and outputting (-c) others that are printable (most of at least).

see man ascii for details, the notation '\001-\010 ....' is in octal to see the exact sets involved.

PS: showing more of this shell file that you are attempting to 'reverse engineer' would be helpful.

-c is complementary, so it deletes (-d) everything BUT the given ranges.
The first two ranges are adjacent; you could combine them in one range:

tr -dc '\001-\015\030-\200'

The octal \200 is one above \177, the highest in the ASCII (7-bit) range.

You will see what exactly it is doing by creating input binary file with 256 bytes from 0x00 to 0xFF. The result binary file is 0x01...0x0D, 0x18...0x80. It removes 0x00, 0x0E...0x17, and 0x81-0xFF. The -dc say exactly to remove everything else but to keep only the bytes from the selected octal ranges. I'm only surprised that it deletes also 0x81 ... \200, but it may be related to that tr is used for character ranges. But in that case why it pass 0x80 is a mystery.

\200 is 0x80
So it deletes the above range \201-\377 aka 0x81-0xFF
There is no miracle.

Early in the morning here, couldn't calculate the octal range properly. Sorry.