Tee: Unterschied zwischen den Versionen

Aus TUXSPACE Wiki
Wechseln zu: Navigation, Suche
(Die Seite wurde neu angelegt: „Category:GNU/LinuxCategory:Todo Das Kommando tee liest von der STDIN und schreibt seine Ausgabe nach STDOUT und in eine Datei. '''Beispiel''' Das Ver…“)
 
Zeile 33: Zeile 33:
 
-rw-r--r-- 1 foo foo 27 Mär  7 05:44 bsp-103.4.dat
 
-rw-r--r-- 1 foo foo 27 Mär  7 05:44 bsp-103.4.dat
 
</pre>
 
</pre>
 
== Das Kommando: xargs ==
 
 
HIER WEITER
 
Allgemeine Syntax: tee [OPTION]... [DATEI]...
 
Option short
 
-a
 
-i
 
Option long
 
- -append
 
- -ignore-interrupts
 
Description
 
Anhängen der Ausgabe an eine bereits bestehende Datei
 
tee wird immun gegen Unterbrechungssignale
 
Listing 3: tee
 
hwe@prometheus: sandbox$ ls -l | tee result.txt
 
insgesamt 48
 
drwxr-xr-x 2 hwe hwe 4096 Feb 24 02:01 bin
 
drwxr-xr-x 2 hwe hwe 4096 Nov 26 01:09 fotos
 
...
 
hwe@prometheus: sandbox$ ls
 
bin
 
lpi-103.2 lpi-103.4 lpi-103.8 music regex
 
fotos lpi-103.3 lpi-103.7 lpi-104.4 news
 
result.txt
 
3 vgl.?,
 
tmp
 

Version vom 12. März 2016, 10:45 Uhr

Das Kommando tee liest von der STDIN und schreibt seine Ausgabe nach STDOUT und in eine Datei.

Beispiel

Das Verzeichnis ~/lpi enthält drei Dateien

foo@dionysos:~/lpi$ ls
bsp-103.2.dat  bsp-103.3.dat  bsp-103.4.dat

Das Ergebnis des Kommandos ls -l wird sowohl nach STDOUT als auch in die Datei result.dat geschrieben.

foo@dionysos:~/lpi$ ls -l | tee result.dat
insgesamt 4
-rw-r--r-- 1 foo foo 0 Mär 8 06:37 bsp-103.2.dat
-rw-r--r-- 1 foo foo 0 Mär 8 06:37 bsp-103.3.dat
-rw-r--r-- 1 foo foo 27 Mär 7 05:44 bsp-103.4.dat

Nun befinden sich vier Dateien im Verzeichnis ~/lpi.

foo@dionysos:~/lpi$ ls
bsp-103.2.dat  bsp-103.3.dat  bsp-103.4.dat  result.dat

Ausgabe von result.dat mit cat.

foo@dionysos:~/lpi$ cat result.dat 
insgesamt 4
-rw-r--r-- 1 foo foo  0 Mär  8 06:37 bsp-103.2.dat
-rw-r--r-- 1 foo foo  0 Mär  8 06:37 bsp-103.3.dat
-rw-r--r-- 1 foo foo 27 Mär  7 05:44 bsp-103.4.dat