Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
Nächste Überarbeitung Beide Seiten der Revision
commands-general-tools [2018/12/09 12:19]
alex [File Stuff] delete recursively all files with a certain name
commands-general-tools [2019/03/13 18:38]
alex [Conversion Stuff] file content character/byte occurences
Zeile 225: Zeile 225:
 convert big_input.tif -resize 256x256 small_output.png convert big_input.tif -resize 256x256 small_output.png
 </​code>​ </​code>​
-[[https://​​cgi/​man.cgi?​query=convert|man convert]] [[https://​​cgi/​man.cgi?​query=ImageMagick|man ImageMagick]]+[[https://​​cgi/​man.cgi?​query=convert&​sektion=1|convert(1)]] [[https://​​cgi/​man.cgi?​query=ImageMagick&​sektion=1|ImageMagick(1)]] 
 +=== make an image grayscale and remove any transparency with ImageMagick === 
 +convert input.png -alpha deactivate -colorspace Gray output.png 
 +[[https://​​cgi/​man.cgi?​query=convert&​sektion=1|convert(1)]] [[https://​​cgi/​man.cgi?​query=ImageMagick&​sektion=1|ImageMagick(1)]] 
 +=== Unix timestamp to human readable time === 
 +<code bash> 
 +## with BSD date 
 +date -r 1523210382 
 +## with GNU date 
 +date -d @1523210382 
 +[[https://​​cgi/​man.cgi?​query=date&​sektion=1|date(1)]] from BSD — [[https://​​stretch/​coreutils/​date.1.en.html|date(1)]] from GNU
 === format XML === === format XML ===
Zeile 234: Zeile 249:
 xmllint --noblanks input_pretty.xml > output_ugly.xml xmllint --noblanks input_pretty.xml > output_ugly.xml
 </​code>​ </​code>​
 === C array of the content of some file === === C array of the content of some file ===
Zeile 239: Zeile 255:
 xxd -i someFile.bin xxd -i someFile.bin
 </​code>​ </​code>​
-[[https://​​cgi/​man.cgi?​query=xxd|man xxd]]+[[https://​​cgi/​man.cgi?​query=xxd&​sektion=1|xxd(1)]]
-=== Unix timestamp to human readable time === +=== change the character encoding of a file‘s content ​=== 
-<​code ​bash+<​code>​ 
-## with BSD date +## convert from "​UTF-8"​ to "​ISO-8859-1"​ 
-date -r 1523210382 +recode utf8...latin1 test.dat  
-## with GNU date +## autodetect and convert to "ISO-8859-1"​ 
-date -d @1523210382+recode ..latin1 test.dat 
 +## list available encodings available in your "​recode"​ build 
 +recode --list
 </​code>​ </​code>​
-[[https://​​cgi/​man.cgi?​query=date|man date]] [[​date.1.en.html|man date]]+[[https://​​cgi/​man.cgi?​query=recode&​sektion=1|recode(1)]]  (more lightweight and probably already installed alternative: ​[[​query=iconv&​sektion=1|iconv(1)]])
 +=== occurrences of non-ASCII characters in a file‘s content (with GNU grep) ===
 +ggrep --color='​auto'​ -P -n "​[\x80-\xFF]"​ file.txt
 +=== occurrences of invalid UTF-8 characters in a file‘s content (this assumes you have an UTF-8 locale set) ===
 +grep -axv '​.*'​ file.txt
 +[[https://​​questions/​29465612/​how-to-detect-invalid-utf8-unicode-binary-in-a-text-file|some StackOverflow discussion]]
 +=== count how many time each byte value occurs in a file‘s content ===
 +recode latin1/​..count-characters < input.dat
 ==== Process Stuff ==== ==== Process Stuff ====
commands-general-tools.txt · Zuletzt geändert: 2020/05/12 01:49 von alex