0

This question already has an answer here:

Input :

MAKTG|MAKTX|MANDT|MATNR|SPRAS
ARALDITE AV 5308
|araldite AV 5308
|910|132252374801|E
HARDER HV 5309
|harder HV 5309
|910|132252374901|E
BAYFLEX 5965 I|Bayflex 5965 I|910|132252380101|E
KUPFERPULVER FEIN 2703|kupferpulver fein 2703|910|132252382701|E

Needed Output:

MAKTG|MAKTX|MANDT|MATNR|SPRAS
ARALDITE AV 5308|araldite AV 5308|910|132252374801|E
HARDER HV 5309|harder HV 5309|910|132252374901|E
BAYFLEX 5965 I|Bayflex 5965 I|910|132252380101|E
KUPFERPULVER FEIN 2703|kupferpulver fein 2703|910|132252382701|E

marked as duplicate by steeldriver, Satō Katsura, Archemar, Philippos, don_crissti Nov 2 '17 at 12:50

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

As, according to the chosen tag, you are on linux, you can do it more simple than the answers given in the duplicated question, using the -z option of GNU sed:

sed -z 's/\n|/|/g'

-z to process the whole file at once, then replace (s) all (g) newlines followed by a bar (\n|) with a bar only.

Not the answer you're looking for? Browse other questions tagged or ask your own question.