Por favor, no se acostumbre a analizar datos estructurados con herramientas no estructuradas. Si está analizando XML, JSON, YAML, etc., use un analizador específico, al menos para convertir los datos estructurados en una forma más apropiada para AWK, sed
, grep
, etc.
En este caso,gron
sería de gran ayuda:
$ gron yourfile | grep -F.properties.
json.items[0].properties.content = "\n#!/bin/bash\n\n# Set KAFKA specific environment variables here.\n\n# The java implementation to use.\nexport JAVA_HOME={{java64_home}}\nexport PATH=/usr/lib/ccache:/home/steve/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/bin\nexport PID_DIR={{kafka_pid_dir}}\nexport LOG_DIR={{kafka_log_dir}}\nexport KAFKA_KERBEROS_PARAMS={{kafka_kerberos_params}}\nexport JMX_PORT=9997\n# Add kafka sink to classpath and related depenencies\nif [ -e \"/usr/lib/ambari-metrics-kafka-sink/ambari-metrics-kafka-sink.jar\" ]; then\n export CLASSPATH=:/usr/lib/ambari-metrics-kafka-sink/ambari-metrics-kafka-sink.jar\n export CLASSPATH=:/usr/lib/ambari-metrics-kafka-sink/lib/*\nfi\n\nif [ -f /etc/kafka/conf/kafka-ranger-env.sh ]; then\n. /etc/kafka/conf/kafka-ranger-env.sh\nfi";
json.items[0].properties.is_supported_kafka_ranger = "true";
json.items[0].properties.kafka_log_dir = "/var/log/kafka";
json.items[0].properties.kafka_pid_dir = "/var/run/kafka";
json.items[0].properties.kafka_user = "kafka";
json.items[0].properties.kafka_user_nofile_limit = "128000";
json.items[0].properties.kafka_user_nproc_limit = "65536";
(Puede publicar -procesar esto con | cut -d. -f4- | gron --ungron
para obtener algo muy parecido a su resultado deseado, aunque aún como JSON válido.)
jq
es también apropiado .
В прошлом (было несколько улучшений работы yum clean all
, в первую очередь https://bugzilla.redhat.com/show_bug.cgi?id=1357083), но вы абсолютно правы в том, что есть крайние случаи, когда yum clean all
просто не выполняет свою работу должным образом.
rm -rf /var/cache/yum
, хотя и противный, каждый раз делает свое дело.
На странице руководства есть короткое сообщение об очистке неотслеживаемых репозиториев:
<...> Also note that untracked (no longer configured) repositories will not be automatically cleaned.
и
To purge the entire cache in one go, the easiest way is to delete the files manually. Depending on your cachedir configuration, this usually means treating any variables as shell wildcards and recursively removing matching directories. For example, if your cachedir is /var/cache/yum/$basearch/$releasever, then the whole /var/cache/yum directory has to be removed. If you do this, yum will rebuild the cache as required the next time it is run (this may take a while).
Что касается последнего пункта о том, что перестроение занимает много времени, вы можете следовать rm -rf /var/cache/yum
с && yum makecache
, чтобы правильно воссоздать каталоги и избежать длительного ожидания при следующем вызове yum. Обратите внимание на разницу между makecache
и makecache fast
, хотя большинство на самом деле не знает разницы. yum makecache fast
только проверяет актуальность репозиториев. yum makecache
фактически загружает метаданные.
Доступен другой вариант:
# yum --enablerepo='*' --verbose clean all
Здесь это объясняется:
# man yum
...
CLEAN OPTIONS
The following are the ways which you can invoke yum in clean mode.
Note that "all files" in the commands below means "all files in currently
enabled repositories". If you want to also clean any (temporarily)
disabled repositories you need to use --enablerepo='*' option.
Но кеши удаленных репозиториев (, что означает «неотслеживаемые» ), будут сохранены:
Disk usage under /var/cache/yum/*/* after cleanup:
4.0 k enabled repos:
0 disabled repos
145 M untracked repos