I've got a file with UTF-8 (Without BOM) coding. File is being created on Windows site and it's being transfered to Linux server through SFTP. Using cat -e
on it, I get something like this:
cat -e file.txt
M-oM-;M-?test13;hbana0Kw;$
lala;LjgX$
Now, I know that M-oM-;M-?
stands for UTF-8 (Without BOM). Is there a way to remove it from file but preseve its coding?
To remove the BOM from the first line of a file you can use something like this sed -e '1 s/^.//' file.txt
.
sed
commands have two parts an address and a command. Most of the time you see sed
used without addresses (which means apply to all lines) but you can restrict the command operation to only specific lines by using addresses.
In this case the address is 1
meaning the first line. So the replacement only applies to the first line and every line is printed (as that is the default sed behaviour).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With