I need to remove ] followed by newline character to convert lines like:
line1]
line2
into:
line1line2
I need to remove ] followed by newline character to convert lines like:
line1]
line2
into:
line1line2
If you've got BASH you've got perl, so:
perl -i.bak -p -e 's/]\n//' FILE
using sed,
sed ':a;N;$!ba;s_]\n__g' <filename>
one more ..
$ sed 'N;s/]\n[ \t]*//' infile
line1line2
If you really need to handle using bash/ksh builtin properties, then
while read line
do
case "$line" in
*]) len=${#line}
((len-=1))
line=${line:0:$len}
echo -n $line
;;
*) echo "$line" ;;
esac
done <<EOF
line]
line2
line3
line4 here]
line5
EOF