Q: How to merge alternate lines to each following column? I'm trying to merge alternate lines regarding each column
input:
ind1 T G T
     T T T 
ind2 G G T 
     G T T

desired Output:
ind1 TT GT TT
ind2 GG GT TT

I tried these commands:
sed 'N;s/\n/ /' <input> output 

and
paste - - <input> output

but it only merge alternate lines but adding the whole line, not considering columns; e.g:
ind1 T G T T T T

ind2 G G T G T T

Any idea using bash or python?

A: awk to the rescue!
$ awk 'NR%2 {n=split($0,a); next} 
            {for(i=1;i<n;i++) $i=a[i+1] $i; 
             print a[1],$0}' file

ind1 TT GT TT
ind2 GG GT TT

Explanation split the odd numbered rows into columns.  Merge with the next row and print. The even numbered rows have one field less, shift and print accordingly.

A: A non-awk solution, since you asked for answers in bash or python:
cut -f 1-4 -d ' ' in   | # the delimiter is a tab here
  sed 's/^/>/'         | # replace the start of the line with a >
    while read a b c d   # read the fields
    do if [[ "$a" = '>' ]]                     # if > then a second line
       then printf "$A\t$B$b\t$C$c\t$D$d\t\n"  # so stack them
       else A=${a#'>'}; B=$b; C=$c; D=$d;      # else set for stack later
       fi
    done

If you want it fast for large amounts of data, I'd use perl.
Or python.
Or C. I hate awk. Not knocking it's ability - I just don't like it.

A: GNU awk solution (for your current input):
awk -F'\t' -v FPAT='[^[:space:]]+' 'NF>3{ h=$1; for(i=1;i<=3;i++) a[i]=$(i+1) }
              NF==3{ print h,a[1]$1,a[2]$2,a[3]$3 }' OFS='\t' file

The output:
ind1    TT  GT  TT
ind2    GG  GT  TT

