Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
ls -t | head как-то не возникает восхищения объектами в пайпах.touch 'a , b " c'
ls -ltQ | head -n 6 | tail -n 5 |
perl -pe '$_=join",",split" ",$_,9;s/\\"/""/g'
-rw-r--r--,1,powerman,powerman,0,июн,2,18:21,"a , b "" c" drwx------,3,powerman,powerman,4096,июн,2,17:53,"Mail" drwxr-xr-x,12,powerman,powerman,4096,июн,2,17:44,"download" drwx------,9,powerman,powerman,4096,июн,2,07:09,"doc" drwxr-xr-x,18,powerman,powerman,4096,май,30,14:21,"tmp"Наверняка существуют утилиты (или хотя бы модули для перла) использование которых сделало бы эту команду короче и читабельнее. Но в ситуации когда один раз за 20 лет понадобилось вывести список файлов в csv — сойдёт и такое.
ls -t | head | tail -n 5 | xargs -i stat -c '%A %n' {}
-rw------- mbox3 -rw------- mbox2 -rw------- mbox1 -rw------- postponed drwxr-xr-x VirtualBox VMs
cpan App::jpath cat test.json | jpath "$.store.book..title"{ "store": {
"book": [
{ "category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
},
{ "category": "fiction",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99
},
{ "category": "fiction",
"author": "Herman Melville",
"title": "Moby Dick",
"isbn": "0-553-21311-3",
"price": 8.99
},
{ "category": "fiction",
"author": "J. R. R. Tolkien",
"title": "The Lord of the Rings",
"isbn": "0-395-19395-8",
"price": 22.99
}
],
"bicycle": {
"color": "red",
"price": 19.95
}
}
}[
"Sayings of the Century",
"Sword of Honour",
"Moby Dick",
"The Lord of the Rings"
]$..book[?(@.price<10)]ls | grep ".exe" | echo
jsplit file | jget [3] | xargs (дальше обычный шелл).jgrep foo *|jiterate -each echo file ${FILENAME} at line ${LINE} match ${MATCH}\> ls | pyp "p[0] | pp.sort() | p + ' first letter, sorted!'" #gives sorted list of first letters of every line
--json, которая любой их вывод приводила бы к некоторому JSON. Далее этот вывод поступает непосредственно на утилиты для работы с JSON.--json из коробки в обычных утилитах.
JSON pipes в шелле