Nieuws:

Welkom, Gast. Alsjeblieft inloggen of registreren.
Heb je de activerings-mail niet ontvangen?

Auteur Topic: SED vervang regel in bestand  (gelezen 308 keer)

Offline Achim

  • Lid
SED vervang regel in bestand
« Gepost op: 2020/09/12, 14:38:59 »
Hallo allemaal!
Misschien kan iemand hier mij helpen?

Ik probeer via SED om een regel te vervangen door de ander, nu heb ik al gezocht op internet maar vindt niet het passende antwoord aangezien er ook speciale karakters gebruikt worden.
Wat ik probeer te berijken is:

sed -i 's/old-text/new-text/g' input.txt
sed -i 's/|$EGREP '^GNU bash, version (3\.[1-9]|4)')/|$EGREP '^GNU bash, version (3\.[1-9]|4|5)')/g' /crosstool-NG/configure.ac
kan iemand mij hiermee helpen?

Offline bart85

  • Lid
Re: SED vervang regel in bestand
« Reactie #1 Gepost op: 2020/09/13, 09:50:17 »
Waarvoor gebruik je het | teken?
Wat staat in variabele $EGREP ?
Waar is (3\.[1-9]|4|5)') voor? Gebruik je hier regex? Wil je meerdere substituties tegelijk uitvoeren?
Wat zijn de old-text en bijbehorende new-text regels?
Relying on complex tools to manage and build your system is going to hurt the end-users. [...] "If you try to hide the complexity of the system, you'll end up with a more complex system". Layers of abstraction that serve to hide internals are never a good thing. Instead, the internals should be designed in a way such that they NEED no hiding.

— Aaron Griffin

Offline bart85

  • Lid
Re: SED vervang regel in bestand
« Reactie #2 Gepost op: 2020/09/13, 19:55:29 »
Deze vraag valt onder programmeren.
Relying on complex tools to manage and build your system is going to hurt the end-users. [...] "If you try to hide the complexity of the system, you'll end up with a more complex system". Layers of abstraction that serve to hide internals are never a good thing. Instead, the internals should be designed in a way such that they NEED no hiding.

— Aaron Griffin