0

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

1 Answers1

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.

Philippos
  • 13,453