How can I re-add a unicode byte order marker in linux?

前端 未结 7 1896
-上瘾入骨i
-上瘾入骨i 2021-02-13 15:22

I have a rather large SQL file which starts with the byte order marker of FFFE. I have split this file using the unicode aware linux split tool into 100,000 line chunks. But whe

7条回答
  •  心在旅途
    2021-02-13 15:39

    Something like (backup first)):

    for i in $(ls *.sql)
    do
      cp "$i" "$i.temp"
      printf '\xFF\xFE' > "$i"
      cat "$i.temp" >> "$i"
      rm "$i.temp"
    done
    

提交回复
热议问题