Comments (1)
  • Add a Comment
  • Edit
  • More Actions v
  • Quarantine this Entry

1 Christoph Jeziorek commented Permalink

Short Shell Command to check for BOM in Text files:

 
for d in `ls -1 *.sql`; do echo "`od -ah $d | head -2` => $d"; done
 
in this example will show the first line in ASCII and blow in HEX mode of any .sql file in the directory inclusive file name.
So you can easy identify if HEX values is not corresponding to ASCII value case that the BOM is set.
You can adjust it to any file extentions you need. I have created an alias at at .bashrc as follows:
 
alias bom='for d in `ls -1 *.sql`; do echo "`od -ah $d | head -2` => $d"; done'
 
Christoph