1

Identify text/ascii files in Linux/Solaris

view story
linux-howto

http://unix.stackexchange.com – I have a little project to build bash script that search in the OS ( Linux/Solaris ) the current IP address from files and replace them with other IP address. The problem is that IP address could be in text file or in not text file as binary/data files, etc. I use the command: file –mime $PATH ( --mime is valid only for Linux ) In order to verify if file is text file, or not text file ( as binary or data file, etc ) Please advice if I do the correct thing. Is my conclusion correct? For example if command: file –mime $PATH Return the results "text/plain" Then its text/ascii fil (HowTos)