> a\tb\t > a\t\t > \tb\t > \t\t\t > > The output for all these should be: > > a|b > a|\s > |b > |\s > > This means that I could start by replacing all tabs with pipes, but then > I would always have to remove the last pipe... > > I could replace two ending pipes with "| " (second and fourth cases), > but I would also have to remove a single ending pipe (first and third > cases)
Then use a '+': s/\|+$/ /; -- Alan