I would like to remove all the newline character that occurs after a partiular string and replace it with a tab space. Say for instance my sample.txt is as follows
In awk:
awk '/foo$/ { printf("%s\t", $0); next } 1'