Skip to content

Shellbefehle und ihre Nützlichkeit

Für viele Unixler ein alter Hut sind Shellskripte. Ich mag sehr gerne Einzeiler. Heute musste ich aus allen RRD-Dateien aus einer Gruppe die Daten rausdumpen und (weil sie sonst viel Platz wegnehmen) gleich komprimieren.

Folgende Zeile macht das einfach (mit bash):

for i in `ls *Application*rrd`; do rrdtool dump $i | gzip -c - > `basename $i rrd`.xml.gz; done

Und dann einfach zurücklehnen und den Tee geniessen :-)

Trackbacks

No Trackbacks

Comments

Display comments as Linear | Threaded

Lalufu on :

Viele shells unterstuetzen auch die notation 'for i in Application*rrd; do ... done', was einem
a) einen Unterprozess spart und
b) sogar mit Dateien, die Leerzeichen enthalten, funktioniert

Add Comment

E-Mail addresses will not be displayed and will only be used for E-Mail notifications.
To leave a comment you must approve it via e-mail, which will be sent to your address after submission.

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

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.
Form options