how can I use linux command sed to process Little-endian UTF-16 file how can I use linux command sed to process Little-endian UTF-16 file shell shell

how can I use linux command sed to process Little-endian UTF-16 file


If the file is UTF-16 encoded text (as RDP is), and that is not your current encoding (it's not likely to be on Linux) then you can pre- and post-process the file with iconv. For example:

iconv -f utf-16 -t us-ascii <rdpzhitong.rdp | sed 's/original/modified/' | iconv -f us-ascii -t utf-16 >rdpzhitong.rdp.modified


if you can cat the file, then you may use sed. no harm in trying before you ask the question.

if the check-free-ip.to.rdpzhitong.rdp file has any text, you may want to do this:

address=$(sed 1q check-free-ip.to.rdpzhitong.rdp)sed -i "s/address:s:.*/address:s:$address/" rdpzhitong.rdp

also, a little advice. try without the -i switch, until you know it's working.