terminal.cab

Alle Befehle

sed

Thema: Text

Programm: sed

Ändert Text Zeile für Zeile nach einem Skript.

Paket: sed

Aufruf

sed [OPTION]... SCRIPT [FILE]...

Beschreibung

Run the editing SCRIPT on every line of the FILEs (or of the keyboard or pipe) and print the result. Without -e or -f the first argument is the SCRIPT. Commands: s/RE/TEXT/ replaces, d deletes, p prints, a, i and c add or change lines, y changes characters, h, H, g, G and x use the hold space, n and N read the next line, q quits.

Optionen im Simulator

6 weitere Optionen des echten Programms, im Simulator noch nicht
  • --debug im Simulator noch nicht

    Im echten Linux zeigt sed dazu, wie es das Skript liest und Zeile für Zeile ausführt.

  • -l, --line-length braucht einen Wert im Simulator noch nicht

    Im echten Linux legt die Option fest, wo der Befehl l lange Zeilen umbricht.

  • --sandbox im Simulator noch nicht

    Im echten Linux verbietet sed dann die Befehle e, r und w.

  • -u, --unbuffered im Simulator noch nicht

    Im echten Linux liest und schreibt sed dann in kleineren Stücken; das Ergebnis bleibt gleich.

  • -z, --null-data im Simulator noch nicht

    Im echten Linux trennt ein Nullbyte statt der Zeilenschaltung die Zeilen.

  • --version im Simulator noch nicht

    Im echten Linux zeigt die Option die Version des Programms.

Beispiele

Aus der Lektion Text ändern mit sed
cat env.conf
API_HOST=staging.example.com
PATHS=/srv/staging:/opt/staging
DEBUG=true
sed 's/staging/production/' env.conf
API_HOST=production.example.com
PATHS=/srv/production:/opt/staging
DEBUG=true
sed 's/staging/production/g' env.conf
API_HOST=production.example.com
PATHS=/srv/production:/opt/production
DEBUG=true

Im Terminal ausprobieren

Wo du ihn lernst

Lektionen

Alle Befehle