Posts mit dem Label bash werden angezeigt. Alle Posts anzeigen
Posts mit dem Label bash werden angezeigt. Alle Posts anzeigen

Donnerstag, 20. Dezember 2012

Number of pages inside a pdf

$ grep -o "'Page[0-9]*'" your.pdf | tail -1 | grep -o "[0-9]*"

Freitag, 9. November 2012

wildcard && brace expansion -eq <3

mplayer *s05e0{1,2,3}*

Queues the following files:
xyz.s05e01.someformat
abc.s05e02.someotherformat
123.s05e03.format
...

Check http://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html

Sonntag, 11. Dezember 2011

Slackware local shutdown script (to wipe out /tmp etc.)

Doesn't exist, but according to rc.local it's ok to create & use it :)

/etc/rc.d/rc.local_shutdown

Mittwoch, 7. Dezember 2011

Copy files recursively without keeping directory structure (Linux)

We had to copy many files that were located in a very complex directory structure. The following snippet searches the current directory and its subdirectories for *.xml files & executes the cp command on every file it finds (the braces {} represent the file):

find -type f -iname '*.xml' -exec cp {} /target/dir/for/all/xmls/ \;

The target dir now contains all *.xml files without directories.