Replace the first character of the current line with the first character of the previous line. For example Input file:
Mark was
Great friend
And
Output file:
Mark was
Mreat friend
Gnd
Must be done with sed
I do not understand how to make the letter replace exactly the beginning of the word on the previous line, all I could do was add a character to the end of the line, but not to the beginning:
sed '2,$ s/[^.]/& &/; 2,$ s/ /\n/' file.txt | paste -d ' ' - -
Output:
Mark was G
Great friend A
And
I don't understand how exactly to specify in the regular expression to work at the beginning of the previous line.