이름: oneline
코드:
--------------------------------------------------------------------------------
#! /bin/bash
SEP=" "
help()
{
echo "Joins multiple lines to one line"
echo "usage: ${0##*/} [-d DELIMETER]"
echo
exit
}
while getopts "d:" opt; do
case $opt in
d) SEP="$OPTARG";;
*) help;;
esac
done
sed -n "H;\${x;s/^\n*//;s/\n*$//;s/\n/$SEP/g;p}"
--------------------------------------------------------------------------------