15 lines
283 B
Bash
Executable file
15 lines
283 B
Bash
Executable file
#!/bin/bash
|
|
# Bash script to tidy a hostname file
|
|
|
|
function clean_file {
|
|
filename="$1"
|
|
if [[ "$filename" == "" ]]; then return 1; fi
|
|
tmpfile="`mktemp`"
|
|
cat "$filename" | sort | uniq > "$tmpfile"
|
|
mv "$tmpfile" "$filename"
|
|
}
|
|
|
|
for filename in "$@"; do
|
|
clean_file "$filename"
|
|
done
|