The symbols are \t and \t\t (note: not tab)
If the line starts with \t merge them into a single line upto symbol \t\t
\t\t to end and start new line
I able to join in a single line but not ending at \t\t and I completely confused
help would be appreciated:b:
Input
\ta tab XXXXXXXXXX
\te tab YYYYYYYYYYY
\t\t
\tc tab DDDDXXXXXX
\tz tab FFFFFFYYYYYYY
output
a tab XXXXXXXXXX tab e tab YYYYYYYYYYY
c tab DDDDXXXXXX tab z tab FFFFFFYYYYYYY
#!/bin/ksh
savestr=""
# remove first \t, we don't need it
sed "s/^\\\t//" filename | while read line
do
case "$line" in
\t*) # \t\t line, so print buffer and empty buffer
echo "$savestr"
savestr=""
;;
*) # not \t\t line, so add current line to the buffer
savestr="$savestr$line "
;;
esac
done
# last line
# if file not end \t\t line, then we have some data in buffer, print it
[ "$savestr" != "" ] && echo "$savestr"