Last active
April 10, 2025 21:37
-
-
Save Busyrev/1e41c58ad081cf861c167eee3f554ea9 to your computer and use it in GitHub Desktop.
Revisions
-
Busyrev revised this gist
Dec 3, 2018 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,10 +8,10 @@ ```find . -type f -iname "*.png" -exec cp {} ./pngs \;``` **выбрать самый большой png по размеру** ```find . -type f -iname \*.png -printf "%s\t%p\n" | sort -n | tail -1``` **Собрать json array из содержимого текстовых файлов, рекурсивно** ```find . -type f -iname \*.eee | perl -e 'print "["; my @a; while(<>){ local $/ = undef; open my $fh, "< $_"; push(@a, <$fh>);} print join(",", @a) . "]"' > meta.json``` **Используя xargs просунуть переданное значение в несколько мест** ```echo a b c | xargs -n1 -I% echo %.zzz %.asdf``` **Найти все логи, взять последнюю строчку, от неё взять первое число, отсортировать и сложить в файл** ```find . -type f -name log.txt | xargs -n1 tail -n1 | awk '{print $1}' | sort -n > times.txt``` -
Busyrev revised this gist
Dec 3, 2018 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,5 +11,7 @@ **Конкатенировать текстовые файлы, рекурсивно** ```find . -type f -iname \*.eee | perl -e 'print "["; my @a; while(<>){ local $/ = undef; open my $fh, "< $_"; push(@a, <$fh>);} print join(",", @a) . "]"' > meta.json``` **Используя xargs просунуть переданное значение в несколько мест** ```echo a b c | xargs -n1 -I% echo %.zzz %.asdf``` **Найти все логи, взять последнюю строчку, от неё взять первое число, отсортировать и сложить в файл** ```find -type f -name log.txt | xargs -n1 tail -n1 | awk '{print $1}' | sort -n > times.txt``` -
Busyrev revised this gist
Nov 29, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,5 +11,5 @@ **Конкатенировать текстовые файлы, рекурсивно** ```find . -type f -iname \*.eee | perl -e 'print "["; my @a; while(<>){ local $/ = undef; open my $fh, "< $_"; push(@a, <$fh>);} print join(",", @a) . "]"' > meta.json``` **Используя xargs просунуть переданное значение в несколько мест** echo a b c | xargs -n1 -I% echo %.zzz %.asdf -
Busyrev revised this gist
Nov 29, 2018 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,4 +10,6 @@ ```find . -type f -iname \*.png -printf "%s\t%p\n" | sort -n | tail -1``` **Конкатенировать текстовые файлы, рекурсивно** ```find . -type f -iname \*.eee | perl -e 'print "["; my @a; while(<>){ local $/ = undef; open my $fh, "< $_"; push(@a, <$fh>);} print join(",", @a) . "]"' > meta.json``` **Используя xargs просунуть переданное значение в несколько мест** echo a b c | xargs -n1 -I% echo mv %.zzz %.asdf -
Busyrev revised this gist
Nov 27, 2018 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,13 @@ **Суммарный вес png в мегабайтах, рекурсивно** ```find . -type f -iname \*.png -ls | awk '{a+=$7}END{print a/1024/1024}'``` **Суммарная площадь png в мегапикселях, рекурсивно** ```find . -type f -iname \*.png | xargs file | awk '{a+=$5*$7}END{print a/1024/1024}'``` **Количество png, рекурсивно** ```find . -type f -iname \*.png | wc -l``` **Скопировать все png в отдельное место, рекурсивно** ```find . -type f -iname "*.png" -exec cp {} ./pngs \;``` **выбрать самый большой png по размеру** ```find . -type f -iname \*.png -printf "%s\t%p\n" | sort -n | tail -1``` **Конкатенировать текстовые файлы, рекурсивно** ```find . -type f -iname \*.eee | perl -e 'print "["; my @a; while(<>){ local $/ = undef; open my $fh, "< $_"; push(@a, <$fh>);} print join(",", @a) . "]"' > meta.json``` -
Busyrev created this gist
Nov 27, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ **Суммарный вес png в мегабайтах, рекурсивно** ```find . -type f -name \*.png -ls|awk '{a+=$7}END{print a/1024/1024}'``` **Суммарная площадь png в мегапикселях, рекурсивно** ```find . -type f -name \*.png|xargs file|awk '{a+=$5*$7}END{print a/1024/1024}'``` **Количество файлов, рекурсивно** ```find . -type f -name \*.png|wc -l``` **Скопировать все png в отдельное место, рекурсивно** ```find . -iname "*.png" -type f -exec cp {} ./pngs \;``` **выбрать самый большой файл по расширению** ```find . -type f -name \*.eec2 -printf "%s\t%p\n" | sort -n | tail -1``` **Конкатенировать текстовые файлы, рекурсивно** ```find . -type f -name \*.eee | perl -e 'print "["; my @a; while(<>){ local $/ = undef; open my $fh, "< $_"; push(@a, <$fh>);} print join(",", @a) . "]"' > meta.json```