Bash скрипт, убирающий все пустоты в тексовом файле

Данный скрипт убирает все пустоты в текстовом файле, включая пробелы и пустые строки:

#!/bin/bash
# Remove blanks in test files
echo -n "Emter a file name : "
read file
out="output.$file"
if [ ! -f $file ]
then
echo "$file not a file!"
exit 1
fi
sed -e 's/[\t ]//g;/^$/d' $file > $out
echo "Output written to $out file"

Leave a Reply

Ваш адрес email не будет опубликован. Обязательные поля помечены *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>