У меня есть текстовый файл со следующим содержимым.
-country
-the
-elections
+countries
+be
+a
+chance
-the
-means
-we
+need
+people’s
+choice
-democracy
+democracies
-elections
-there
+increases
+their
Я хочу строку слияния, которая имеет такой же стартовый шаблон.Для вышеприведенного файла вывод должен быть
-country -the -elections
+countries +be +a +chance
-the -means -we
+need +people’s +choice
-democracy
+democracies
-elections -there
+increases +their
Я пробовал с
sed '/^-/{N;s/\n/ /}' diff_1.txt
, но его строка слияния начинается с - и это тоже неправильно, как и ожидалось.