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
Here is how:
cat input.txt | sed ':a;N;$!ba;s/foo\n/foo\t/g'
More about why simple sed 's/foo\n/foo\t/g' does not work here: http://linuxtopia.org/online_books/linux_tool_guides/the_sed_faq/sedfaq5_009.html
sed 's/foo\n/foo\t/g'