-
使用 -n 選項指定最小字符串長度:
strings -n <length> <file>
例如,要提取長度至少為 6 的字符串,可以使用:
strings -n 6 <file>
-
使用 -e 選項指定字符編碼:
strings -e <encoding> <file>
其中
可以是 ASCII, ibm, utf8, ucs2, utf16le, utf16be, utf32le, utf32be 等。 例如,要使用 UTF-8 編碼提取字符串,可以使用:
strings -e utf8 <file>
-
使用 -t 選項以十六進制格式顯示字符串:
strings -t <format> <file>
其中
可以是 x(默認值,顯示為十六進制),d(顯示為十進制)或 o(顯示為八進制)。 例如,要以十進制格式顯示字符串,可以使用:
strings -t d <file>
-
使用 -T 選項指定輸出格式:
strings -T <type> <file>
其中
可以是 s(顯示字符串),a(顯示地址),i(顯示整數)或 b(顯示字節)。 例如,要同時顯示字符串及其地址,可以使用:
strings -T sa <file>
你可以根據需要組合這些選項來定制 strings 命令的輸出格式。例如,要提取長度至少為 6 的 UTF-8 編碼字符串,并以十六進制和十進制格式顯示它們及其地址,可以使用:
strings -n 6 -e utf8 -T sxd <file>