Remove BOM from any number of files – one-liner

Removal of the BOM (byte order mark) is a common problem. For single files there are easy ways to use Notepad++ or Vi. For a large number of files in one directory you want to use another approach. Here is a useful Linux one-liner:

This iterates over all files in a directory, removes the BOM and creates a backup file for each file modified.

If you don’t need a backup file just use this one-liner:


2 People think it's helpful 😀

Leave a Reply

Your email address will not be published. Required fields are marked *