Amazing. Glad to know that worked! Thanks to lcerf and enduzzer for
explaining my command I learned new thing.
Thanks, everyone!
This code did the job:
#!/bin/bash
for filename in $HOME/Documents/bom/*.log; do
sed -i $'1s/^\uFEFF//' "$filename"
done
No doubt a for loop would do the trick.
https://en.wikipedia.org/wiki/For_loop
There's a utility 'bomstrip' (tool to strip Byte-Order Marks from UTF-8 text
files).
sudo apt install bomstrip
https://www.ueber.net/who/mjl/projects/bomstrip/
http://muzso.hu/2011/11/08/using-awk-sed-to-detect-remove-the-byte-order-mark-bom
Can't we just use looping for that? For example, I use this command to
process multiple files. It removes lines with hashtag sign in every
TXT file of all TXT files in current directory. What do you think?
for filename in file*.txt; do sed -i '/#/d' $filename; done
That line seems to work as intended. Now, we need Magic Banana tell us how to
process the remaining 699 log files automatically.
https://stackoverflow.com/questions/45240387/how-can-i-remove-the-bom-from-a-utf-8-file
sed -i $'1s/^\uFEFF//' file.txt
Hello
BOM: Byte order mark
Wikipedia article: https://en.wikipedia.org/wiki/Byte_order_mark
The UTF-8 representation of the BOM is the (hexadecimal) byte sequence
0xEF,0xBB,0xBF.
The Unicode Standard permits the BOM in UTF-8, but does not require or
recommend its use.
I have 700 log files