Skip to content

sed benutzen, ist nicht immer einfach

Ich wollte gerade in einer Datei ein paar Einträge hin- und her schieben. Hierzu nutzte ich das Programm sed:

sed ‘s,\(foo\)\(bar\)\(baz\),\1\2\3,’ $DATEI

Es hat mich doch einige Blicke gekostet, um herauszufinden, warum sich an der Datei gar nichts geändert hat ...

Trackbacks

No Trackbacks

Comments

Display comments as Linear | Threaded

Martin Grandrath on :

Was genau hast du denn erwartet, was passiert? Oder einfach nur “-r” vergessen? ;-)

Thorsten on :

-i wäre hilfreich :-)

Thorsten on :

und natürlich wäre es gut die Variablen neu anzuordnen, sonst beweist es nur, dass das matching funktioniert ;-)

Jens Kubieziel on :

Wie Thorsten schon richtig vermutete, bringt \1\2\3 nichts, wenn man die Werte eigentlich umsortieren will. In dem Fall sollte es \2\1\3 sein.

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.
BBCode format allowed
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

You can use [geshi lang=lang_name [,ln={y|n}]][/geshi] tags to embed source code snippets.
Form options
cronjob