Search Results

Search found 1 results on 1 pages for 'vog'.

Page 1/1 | 1 

  • Elegant way to search for UTF-8 files with BOM?

    - by vog
    For debugging purposes, I need to recursively search a directory for all files which start with a UTF-8 byte order mark (BOM). My current solution is a simple shell script: find -type f | while read file do if [ "`head -c 3 -- "$file"`" == $'\xef\xbb\xbf' ] then echo "found BOM in: $file" fi done Or, if you prefer short, unreadable one-liners: find -type f|while read file;do [ "`head -c3 -- "$file"`" == $'\xef\xbb\xbf' ] && echo "found BOM in: $file";done It doesn't work with filenames that contain a line break, but such files are not to be expected anyway. Is there any shorter or more elegant solution? Are there any interesting text editors or macros for text editors?

    Read the article

1