Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
-1
votes
0
answers
46
views
How can I fix clash's parse config error: incorrect UUID length 4 in string "uuid"?
I have just installed clash from my Linux distribution's repository, and both my Linux distribution and clash are outdated (which, I am not sure, is the cause of the following problem): $ clash -v Clash 1.16.0 linux amd64 with go1.20.8 unknown time I got the following config error when running clash...
I have just installed clash from my Linux distribution's repository, and both my Linux distribution and clash are outdated (which, I am not sure, is the cause of the following problem):
$ clash -v
Clash 1.16.0 linux amd64 with go1.20.8 unknown time
I got the following config error when running clash
$ clash
FATA Parse config error: proxy 3: uuid: incorrect UUID length 4 in string "uuid"
I have made
~/.config/clash/config.yaml
(whose content is copied and pasted at the end of this post) to be the same as the one in
https://doreamon-design.github.io/clash/configuration/configuration-reference.html , except the following part for section proxy-providers
(see https://doreamon-design.github.io/clash/configuration/outbound.html for detailed information):
proxy-providers:
provider1:
type: http
url: "https://node.freev2raynode.com/uploads/2025/08/1-20250807.yaml "
interval: 3600
path: ./provider1.yaml
health-check:
enable: true
interval: 600
# lazy: true
url: http://www.gstatic.com/generate_204
test:
type: file
path: /test.yaml
health-check:
enable: true
interval: 36000
url: http://www.gstatic.com/generate_204
Is the uuid error in ~/.config/clash/config.yaml
or https://node.freev2raynode.com/uploads/2025/08/1-20250807.yaml ? How can I fix it?
In config.yaml, uuid appears in
> uuid: uuid
as in
# vmess
# cipher support auto/aes-128-gcm/chacha20-poly1305/none
- name: "vmess"
type: vmess
server: server
port: 443
uuid: uuid
alterId: 32
cipher: auto
If there's a problem there, what's it and how is it fixed?
Thanks!
****************************
In https://node.freev2raynode.com/uploads/2025/08/1-20250807.yaml , uuid
has appeared in the following part:
proxies:
- {name: HK香港(mibei77.com 米贝节点分享), server: free-relay.themars.top, port: 37906, type: vmess, uuid: 90030631-4027-4810-8ce9-3e9095390f2d, alterId: 0, cipher: auto, tls: false, skip-cert-verify: true, network: ws, ws-path: /cctv1.m3u8, ws-headers: {Host: www.cctv.com}, udp: true}
- {name: US美国(mibei77.com 米贝节点分享), server: 45.67.215.95, port: 443, type: trojan, password: tg-fq521free, skip-cert-verify: true, udp: true}
- {name: US美国(mibei77.com 米贝节点分享) 2, server: dDdDdDdddDDDDyUUUIO.4444926.XyZ, port: 80, type: vmess, uuid: dc50eb1d-244d-4711-b168-a101a5e6fb1b, alterId: 0, cipher: auto, tls: false, skip-cert-verify: true, network: ws, ws-path: /awmqq79B17rfnpXiNaWb, ws-headers: {Host: dddddddddddddyuuuio.4444926.xyz}, udp: true}
- {name: US美国(mibei77.com 米贝节点分享) 3, server: switcher-nick-croquet.freesocks.work, port: 443, type: ss, cipher: chacha20-ietf-poly1305, password: 9tqhMdIrTkgQ46PvhyAtMH, udp: true}
- {name: US美国(mibei77.com 米贝节点分享) 4, server: 172.67.214.21, port: 443, type: trojan, password: 7248e825-887c-48b9-83bc-c26bc6392bf8, skip-cert-verify: true, udp: true}
- {name: HK香港(mibei77.com 米贝节点分享) 2, server: v29.heduian.link, port: 30829, type: vmess, uuid: cbb3f877-d1fb-344c-87a9-d153bffd5484, alterId: 2, cipher: auto, tls: false, skip-cert-verify: true, network: ws, ws-path: /oooo, ws-headers: {Host: ocbc.com}, udp: true}
- {name: JP日本(mibei77.com 米贝节点分享), server: arxfw2b78fi2q9hzylhn.freesocks.work, port: 443, type: ss, cipher: chacha20-ietf-poly1305, password: Nk9asglDzHzjktVzTkvhaA, udp: true}
- {name: US美国(mibei77.com 米贝节点分享) 5, server: rrrrrrrrrt.11890604.xyz, port: 443, type: vmess, uuid: f898ffcb-6417-4373-9640-0b66091e8206, alterId: 0, cipher: auto, tls: true, skip-cert-verify: true, network: ws, ws-path: /GnJ3bBxV91uFkYtuzXyJ5XNeH1R1, ws-headers: {Host: rrrrrrrrrt.11890604.xyz}, udp: true}
- {name: US美国(mibei77.com 米贝节点分享) 6, server: 141.11.203.26, port: 8880, type: vmess, uuid: 1fcb582e-7ffb-3708-8a0f-96c2a070e40d, alterId: 0, cipher: auto, tls: false, skip-cert-verify: true, network: ws, ws-path: "/dabai&Telegram🇨🇳@WangCai2/?ed=2560", ws-headers: {Host: TG.WangCai2.s2.cn-db.top}, udp: true}
********************************
~/.config/clash/config.yaml
:
# Port of HTTP(S) proxy server on the local end
port: 7890
# Port of SOCKS5 proxy server on the local end
socks-port: 7891
# Transparent proxy server port for Linux and macOS (Redirect TCP and TProxy UDP)
# redir-port: 7892
# Transparent proxy server port for Linux (TProxy TCP and TProxy UDP)
# tproxy-port: 7893
# HTTP(S) and SOCKS4(A)/SOCKS5 server on the same port
# mixed-port: 7890
# authentication of local SOCKS5/HTTP(S) server
# authentication:
# - "user1:pass1"
# - "user2:pass2"
# Set to true to allow connections to the local-end server from
# other LAN IP addresses
# allow-lan: false
# This is only applicable when allow-lan
is true
# '*': bind all IP addresses
# 192.168.122.11: bind a single IPv4 address
# "[aaaa::a8aa:ff:fe09:57d8]": bind a single IPv6 address
# bind-address: '*'
# Clash router working mode
# rule: rule-based packet routing
# global: all packets will be forwarded to a single endpoint
# direct: directly forward the packets to the Internet
mode: rule
# Clash by default prints logs to STDOUT
# info / warning / error / debug / silent
# log-level: info
# When set to false, resolver won't translate hostnames to IPv6 addresses
# ipv6: false
# RESTful web API listening address
external-controller: 127.0.0.1:9090
# A relative path to the configuration directory or an absolute path to a
# directory in which you put some static web resource. Clash core will then
# serve it at http://{{external-controller}}/ui
.
# external-ui: folder
# Secret for the RESTful API (optional)
# Authenticate by spedifying HTTP header Authorization: Bearer ${secret}
# ALWAYS set a secret if RESTful API is listening on 0.0.0.0
# secret: ""
# Outbound interface name
# interface-name: en0
# fwmark on Linux only
# routing-mark: 6666
# Static hosts for DNS server and connection establishment (like /etc/hosts)
#
# Wildcard hostnames are supported (e.g. *.clash.dev, *.foo.*.example.com)
# Non-wildcard domain names have a higher priority than wildcard domain names
# e.g. foo.example.com > *.example.com > .example.com
# P.S. +.foo.com equals to .foo.com and foo.com
# hosts:
# '*.clash.dev': 127.0.0.1
# '.dev': 127.0.0.1
# 'alpha.clash.dev': '::1'
# profile:
# Store the select
results in $HOME/.config/clash/.cache
# set false If you don't want this behavior
# when two different configurations have groups with the same name, the selected values are shared
# store-selected: true
# persistence fakeip
# store-fake-ip: false
# DNS server settings
# This section is optional. When not present, the DNS server will be disabled.
dns:
enable: false
listen: 0.0.0.0:53
# ipv6: false # when the false, response to AAAA questions will be empty
# These nameservers are used to resolve the DNS nameserver hostnames below.
# Specify IP addresses only
default-nameserver:
- 114.114.114.114
- 8.8.8.8
# enhanced-mode: fake-ip
fake-ip-range: 198.18.0.1/16 # Fake IP addresses pool CIDR
# use-hosts: true # lookup hosts and return IP record
# search-domains: [local] # search domains for A/AAAA record
# Hostnames in this list will not be resolved with fake IPs
# i.e. questions to these domain names will always be answered with their
# real IP addresses
# fake-ip-filter:
# - '*.lan'
# - localhost.ptlogin2.qq.com
# Supports UDP, TCP, DoT, DoH. You can specify the port to connect to.
# All DNS questions are sent directly to the nameserver, without proxies
# involved. Clash answers the DNS question with the first result gathered.
nameserver:
- 114.114.114.114 # default value
- 8.8.8.8 # default value
- tls://dns.rubyfish.cn:853 # DNS over TLS
- https://1.1.1.1/dns-query # DNS over HTTPS
- dhcp://en0 # dns from dhcp
# - '8.8.8.8#en0'
# When fallback
is present, the DNS server will send concurrent requests
# to the servers in this section along with servers in nameservers
.
# The answers from fallback servers are used when the GEOIP country
# is not CN
.
# fallback:
# - tcp://1.1.1.1
# - 'tcp://1.1.1.1#en0'
# If IP addresses resolved with servers in nameservers
are in the specified
# subnets below, they are considered invalid and results from fallback
# servers are used instead.
#
# IP address resolved with servers in nameserver
is used when
# fallback-filter.geoip
is true and when GEOIP of the IP address is CN
.
#
# If fallback-filter.geoip
is false, results from nameserver
nameservers
# are always used if not match fallback-filter.ipcidr
.
#
# This is a countermeasure against DNS pollution attacks.
# fallback-filter:
# geoip: true
# geoip-code: CN
# ipcidr:
# - 240.0.0.0/4
# domain:
# - '+.google.com'
# - '+.facebook.com'
# - '+.youtube.com'
# Lookup domains via specific nameservers
# nameserver-policy:
# 'www.baidu.com': '114.114.114.114'
# '+.internal.crop.com': '10.0.0.1'
proxies:
# Shadowsocks
# The supported ciphers (encryption methods):
# aes-128-gcm aes-192-gcm aes-256-gcm
# aes-128-cfb aes-192-cfb aes-256-cfb
# aes-128-ctr aes-192-ctr aes-256-ctr
# rc4-md5 chacha20-ietf xchacha20
# chacha20-ietf-poly1305 xchacha20-ietf-poly1305
- name: "ss1"
type: ss
server: server
port: 443
cipher: chacha20-ietf-poly1305
password: "password"
# udp: true
- name: "ss2"
type: ss
server: server
port: 443
cipher: chacha20-ietf-poly1305
password: "password"
plugin: obfs
plugin-opts:
mode: tls # or http
# host: bing.com
- name: "ss3"
type: ss
server: server
port: 443
cipher: chacha20-ietf-poly1305
password: "password"
plugin: v2ray-plugin
plugin-opts:
mode: websocket # no QUIC now
# tls: true # wss
# skip-cert-verify: true
# host: bing.com
# path: "/"
# mux: true
# headers:
# custom: value
# vmess
# cipher support auto/aes-128-gcm/chacha20-poly1305/none
- name: "vmess"
type: vmess
server: server
port: 443
uuid: uuid
alterId: 32
cipher: auto
# udp: true
# tls: true
# skip-cert-verify: true
# servername: example.com # priority over wss host
# network: ws
# ws-opts:
# path: /path
# headers:
# Host: v2ray.com
# max-early-data: 2048
# early-data-header-name: Sec-WebSocket-Protocol
- name: "vmess-h2"
type: vmess
server: server
port: 443
uuid: uuid
alterId: 32
cipher: auto
network: h2
tls: true
h2-opts:
host:
- http.example.com
- http-alt.example.com
path: /
- name: "vmess-http"
type: vmess
server: server
port: 443
uuid: uuid
alterId: 32
cipher: auto
# udp: true
# network: http
# http-opts:
# # method: "GET"
# # path:
# # - '/'
# # - '/video'
# # headers:
# # Connection:
# # - keep-alive
- name: vmess-grpc
server: server
port: 443
type: vmess
uuid: uuid
alterId: 32
cipher: auto
network: grpc
tls: true
servername: example.com
# skip-cert-verify: true
grpc-opts:
grpc-service-name: "example"
# socks5
- name: "socks"
type: socks5
server: server
port: 443
# username: username
# password: password
# tls: true
# skip-cert-verify: true
# udp: true
# http
- name: "http"
type: http
server: server
port: 443
# username: username
# password: password
# tls: true # https
# skip-cert-verify: true
# sni: custom.com
# Snell
# Beware that there's currently no UDP support yet
- name: "snell"
type: snell
server: server
port: 44046
psk: yourpsk
# version: 2
# obfs-opts:
# mode: http # or tls
# host: bing.com
# Trojan
- name: "trojan"
type: trojan
server: server
port: 443
password: yourpsk
# udp: true
# sni: example.com # aka server name
# alpn:
# - h2
# - http/1.1
# skip-cert-verify: true
- name: trojan-grpc
server: server
port: 443
type: trojan
password: "example"
network: grpc
sni: example.com
# skip-cert-verify: true
udp: true
grpc-opts:
grpc-service-name: "example"
- name: trojan-ws
server: server
port: 443
type: trojan
password: "example"
network: ws
sni: example.com
# skip-cert-verify: true
udp: true
# ws-opts:
# path: /path
# headers:
# Host: example.com
# ShadowsocksR
# The supported ciphers (encryption methods): all stream ciphers in ss
# The supported obfses:
# plain http_simple http_post
# random_head tls1.2_ticket_auth tls1.2_ticket_fastauth
# The supported supported protocols:
# origin auth_sha1_v4 auth_aes128_md5
# auth_aes128_sha1 auth_chain_a auth_chain_b
- name: "ssr"
type: ssr
server: server
port: 443
cipher: chacha20-ietf
password: "password"
obfs: tls1.2_ticket_auth
protocol: auth_sha1_v4
# obfs-param: domain.tld
# protocol-param: "#"
# udp: true
proxy-groups:
# relay chains the proxies. proxies shall not contain a relay. No UDP support.
# Traffic: clash http vmess ss1 ss2 Internet
- name: "relay"
type: relay
proxies:
- http
- vmess
- ss1
- ss2
# url-test select which proxy will be used by benchmarking speed to a URL.
- name: "auto"
type: url-test
proxies:
- ss1
- ss2
- vmess1
# tolerance: 150
# lazy: true
url: 'http://www.gstatic.com/generate_204 '
interval: 300
# fallback selects an available policy by priority. The availability is tested by accessing an URL, just like an auto url-test group.
- name: "fallback-auto"
type: fallback
proxies:
- ss1
- ss2
- vmess1
url: 'http://www.gstatic.com/generate_204 '
interval: 300
# load-balance: The request of the same eTLD+1 will be dial to the same proxy.
- name: "load-balance"
type: load-balance
proxies:
- ss1
- ss2
- vmess1
url: 'http://www.gstatic.com/generate_204 '
interval: 300
# strategy: consistent-hashing # or round-robin
# select is used for selecting proxy or proxy group
# you can use RESTful API to switch proxy is recommended for use in GUI.
- name: Proxy
type: select
# disable-udp: true
# filter: 'someregex'
proxies:
- ss1
- ss2
- vmess1
- auto
# direct to another interfacename or fwmark, also supported on proxy
- name: en1
type: select
interface-name: en1
routing-mark: 6667
proxies:
- DIRECT
- name: UseProvider
type: select
use:
- provider1
proxies:
- Proxy
- DIRECT
proxy-providers:
provider1:
type: http
url: "https://node.freev2raynode.com/uploads/2025/08/1-20250807.yaml "
interval: 3600
path: ./provider1.yaml
health-check:
enable: true
interval: 600
# lazy: true
url: http://www.gstatic.com/generate_204
test:
type: file
path: /test.yaml
health-check:
enable: true
interval: 36000
url: http://www.gstatic.com/generate_204
tunnels:
# one line config
- tcp/udp,127.0.0.1:6553,114.114.114.114:53,proxy
- tcp,127.0.0.1:6666,rds.mysql.com:3306,vpn
# full yaml config
- network: [tcp, udp]
address: 127.0.0.1:7777
target: target.com
proxy: proxy
rules:
- DOMAIN-SUFFIX,google.com,auto
- DOMAIN-KEYWORD,google,auto
- DOMAIN,google.com,auto
- DOMAIN-SUFFIX,ad.com,REJECT
- SRC-IP-CIDR,192.168.1.201/32,DIRECT
# optional param "no-resolve" for IP rules (GEOIP, IP-CIDR, IP-CIDR6)
- IP-CIDR,127.0.0.0/8,DIRECT
- GEOIP,CN,DIRECT
- DST-PORT,80,DIRECT
- SRC-PORT,7777,DIRECT
- RULE-SET,apple,REJECT # Premium only
- MATCH,auto
Tim
(106420 rep)
Aug 6, 2025, 08:15 PM
• Last activity: Aug 7, 2025, 09:30 AM
5
votes
5
answers
3213
views
Replace all occurrences of dash to the left of a colon using sed
I have the following values in a `config.yml` file: scratch-org-def: config/project-scratch-def.json assign-permset: false permset-name: run-apex-tests: true apex-test-format: tap delete-scratch-org: false show-scratch-org-url: true I need to replace all occurrences of dashes (-) to the left of the...
I have the following values in a
config.yml
file:
scratch-org-def: config/project-scratch-def.json
assign-permset: false
permset-name:
run-apex-tests: true
apex-test-format: tap
delete-scratch-org: false
show-scratch-org-url: true
I need to replace all occurrences of dashes (-) to the left of the colon (:) with underscores (_).
I've tried sed '/.*: /s/-/_/g' config.yml
but it replaces all dashes (including the config/project-scratch-def.json
).
I've tried sed '/^[^:]*:/s/-/_/g' config.yml
, hoping to stop at the colon, but it does the same.
Wade
(153 rep)
Feb 10, 2018, 05:11 PM
• Last activity: May 12, 2025, 06:57 PM
6
votes
5
answers
11076
views
How do I remove all specific sub-sections of a specific header in a YAML file?
I'm using bash shell. I have a YAML file from which I want to remove certain blocks of text. /image-content: post: operationId: createEventPublic summary: Process events description: Process events parameters: [] requestBody: required: true content: application/json: schema: $ref: '#/components/sche...
I'm using bash shell. I have a YAML file from which I want to remove certain blocks of text.
/image-content:
post:
operationId: createEventPublic
summary: Process events
description: Process events
parameters: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Content'
responses:
'201':
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/Content'
/text-content:
post:
operationId: createStaticText
summary: Process text events
description: Process text events
parameters: []
requestBody:
...
I would like to remove (as an example) the block of text where the path contains "image-content". Normally I can use this to remove a single line with that text
sed -i '/image-content/d' ./infile
but I'm less clear how to replace every line after that up until the next line that begins with two spaces and a "/" (e.g. " /"). In the above, I would want to remove everything up until
/text-content:
Edit: Although this may not be valid openapi 3 swagger, I believe it is still a valid YAML file
openapi: 3.0.0
components:
/static/image-content:
post:
type: hello
/api/hello:
post:
type: hello
/static/css-content:
post:
type: hello
Ultimately, I would like to remove the blocks beginning with "/static". So the ending doc would be
openapi: 3.0.0
components:
/api/hello:
post:
type: hello
Dave
(2808 rep)
May 7, 2021, 08:28 PM
• Last activity: May 3, 2025, 07:22 PM
2
votes
2
answers
420
views
Merging values from 2 YAML files in bash
A bash command: $(System.DefaultWorkingDirectory)/yq_linux_amd64 '. *= load("${{ parameters.HELM_CHART_PATH }}/values/DEV/${{ parameters.COMPONENT }}.yaml")' ${{ parameters.HELM_CHART_PATH }}/values/global-values.yaml > $(System.DefaultWorkingDirectory)/deployment-values.yaml Is merging values from...
A bash command:
$(System.DefaultWorkingDirectory)/yq_linux_amd64 '. *= load("${{ parameters.HELM_CHART_PATH }}/values/DEV/${{ parameters.COMPONENT }}.yaml")' ${{ parameters.HELM_CHART_PATH }}/values/global-values.yaml > $(System.DefaultWorkingDirectory)/deployment-values.yaml
Is merging values from 2 YAML files and sending merged output to a single file. I am unable to understand the syntax from the first single quote until the output is redirected. Can anyone help me understand what it means?
Why are both operands after the operator, which is
*=
? .
is the current directory, but what does it mean before *=
?
Also, why only 1st operand is between load ()
and what is its meaning?
Mihir
(47 rep)
Apr 16, 2025, 11:36 PM
• Last activity: Apr 24, 2025, 09:21 PM
-1
votes
2
answers
704
views
How do I use yq to replace nameserver IPs in netplan YAML configuration?
Here is my YAML file: ```yaml network: ethernets: ens160: addresses: - 10.200.2.148/22 gateway4: 10.200.0.1 nameservers: addresses: - 1.1.1.1 - 2.2.2.2 - 3.3.3.3 - 4.4.4.4 search: - our.domain ``` I must replace all DNS addresses under `ens160` with two specific addresses. I tried using this: ```sh...
Here is my YAML file:
network:
ethernets:
ens160:
addresses:
- 10.200.2.148/22
gateway4: 10.200.0.1
nameservers:
addresses:
- 1.1.1.1
- 2.2.2.2
- 3.3.3.3
- 4.4.4.4
search:
- our.domain
I must replace all DNS addresses under ens160
with two specific addresses.
I tried using this:
yq write -i /etc/netplan/00-installer-config.yaml '.network.ethernets.ens160.nameservers.addresses' ['10.10.10.53','10.10.10.54']
... but all that did was shift all the list items in one like this:
network:
ethernets:
ens160:
addresses:
- 10.200.2.148/22
gateway4: 10.200.0.1
nameservers:
addresses:
- 1.1.1.1
- 2.2.2.2
- 3.3.3.3
- 4.4.4.4
search:
- our.domain
I don't want that. I need the output to look like this:
network:
ethernets:
ens160:
addresses:
- 10.200.2.148/22
gateway4: 10.200.0.1
nameservers:
addresses:
- 10.10.10.53
- 10.10.10.54
search:
- our.domain
It's not very clear how I can do this with yq
. How can I accomplish this?
Dave
(700 rep)
Mar 25, 2023, 08:40 PM
• Last activity: Apr 13, 2025, 09:31 AM
0
votes
2
answers
147
views
yq to replace YAML property with multiple words value
Given a YAML file, `example.yaml`: ```YAML services: api: image: myImage ports: - 8080:8080 environment: - "TEST_STRING_WITH_SPACE=?" ``` I need to replace the `TEST_STRING_WITH_SPACE` environment variable value with a multiple words string param. Expected is like that: ```YAML services: api: image:...
Given a YAML file,
example.yaml
:
services:
api:
image: myImage
ports:
- 8080:8080
environment:
- "TEST_STRING_WITH_SPACE=?"
I need to replace the TEST_STRING_WITH_SPACE
environment variable value with a multiple words string param. Expected is like that:
services:
api:
image: myImage
ports:
- 8080:8080
environment:
- "TEST_STRING_WITH_SPACE=With Space"
I'm using yq
tool, version:
yq (https://github.com/mikefarah/yq/) version v4.44.5
When I try to set value with a string without space, it works:
yq '.services.api.environment = "TEST_STRING_WITH_SPACE='$(echo "WithoutSpace")'"' example.yaml
But, when I try to set value with a string with space, it does't works:
yq '.services.api.environment = "TEST_STRING_WITH_SPACE='$(echo "With Space")'"' example.yaml
Got the error:
> Error: 1:32: invalid input text "\"TEST_STRING_WIT..."
How fix it?
Allan Andrade
(133 rep)
Mar 20, 2025, 01:14 PM
• Last activity: Apr 9, 2025, 11:27 AM
0
votes
1
answers
27
views
How to check git porcelain on CI step?
I added this step to CI ```lang-yaml check_if_there_is_change: - run: name: Check that no git-tracked files were modified command: | FILES_MODIFIED="$(git status --porcelain)" if [[ -n "$FILES_MODIFIED" ]]; then echo "The following files were modified or added during the build process:" echo "$FILES...
I added this step to CI
-yaml
check_if_there_is_change:
- run:
name: Check that no git-tracked files were modified
command: |
FILES_MODIFIED="$(git status --porcelain)"
if [[ -n "$FILES_MODIFIED" ]]; then
echo "The following files were modified or added during the build process:"
echo "$FILES_MODIFIED"
echo "This will likely prevent successful publishing. Please run the build locally and include these changes in your pull request)"
exit 1
fi
But it fails
-plaintext
yaml.scanner.ScannerError: while scanning a simple key
in ".circleci/main.yml", line 638, column 11
could not find expected ':'
in ".circleci/main.yml", line 639, column 9
IntelliJ shows invalid child element in block mapping.
How to change this?
I want to know if files have been modified.
Milenko Markovic
(17 rep)
Jan 24, 2025, 02:01 PM
• Last activity: Feb 14, 2025, 05:26 AM
0
votes
2
answers
92
views
How to search for a newline that is not preceeded by } and remove it
I want to use `sed` to search for line breaks that are not preceded by `}`. The regex for identifying theses cases is: `[^}]$` . What I want to say: If the line ended without `}` then remove the new line. Any line should end with `}` before the newline. How to put that in `sed` to remove them? **EDI...
I want to use
sed
to search for line breaks that are not preceded by }
.
The regex for identifying theses cases is: [^}]$
. What I want to say: If the line ended without }
then remove the new line. Any line should end with }
before the newline.
How to put that in sed
to remove them?
**EDIT:**
Example:
{'Date': 'Fri, 19 Apr 2019 07:23:14 GMT', 'Server': 'Apache', 'Vary': 'Qualys-Scan', 'Strict-Transport-Security': 'max-age=31536000;includeSubDomains;preload', 'Set-Cookie': 'ASP.NET_SessionId=ivoa5bhet0s2ygkylmimvkie; path=/; secure; HttpOnly;SameSite=strict, SC_ANALYTICS_GLOBAL_COOKIE=12f133ea; expires=Thu, 19-Apr-2029 07:23:14 GMT; path=/; secure; HttpOnly;SameSite=strict, SC_ANALYTICS_SESSION_COOKIE=336B5|1|ivoa5; path=/; secure; HttpOnly;SameSite=strict, incap_ses_885_270026=cDp/VlO1AHgshF9F6SZID==; path=/; Domain=.zurich.co.uk, ___utmvm=dlNaoEsuXSO; path=/; Max-Age=900, ___utmvay=nWJx01KvGT; path=/; Max-Age=900, ___utm=JZy
XEtOwalQ: PtR; path=/; Max-Age=900', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Cache-Control': 'private', 'Content-Type': 'text/html; charset=utf-8', 'Keep-Alive': 'timeout=5, max=10', 'Connection': 'Keep-Alive', 'X-Iinfo': '8-3925806-3807 NNNN CT(73 151 0) RT(155583 5) q(0 0 3 0) r(6 6) U5', 'X-CDN': 'Incapsula', 'Content-Encoding': 'gzip', 'Transfer-Encoding': 'chunked'}
When I applied your script, it combined the lines. However, the new line starts with tab
. How to also remove the spaces if the newline starts with spaces?
None
(219 rep)
May 11, 2019, 12:51 PM
• Last activity: Dec 29, 2024, 09:45 AM
2
votes
1
answers
904
views
line 41: field enabled not found in type aggregation.Config when start loki
when I am using this command to start loki: loki --config.file=./config.yml show error like this: failed parsing config: ./config.yml: yaml: unmarshal errors: line 41: field enabled not found in type aggregation.Config. Use `-config.expand-env=true` flag if you want to expand environment variables i...
when I am using this command to start loki:
loki --config.file=./config.yml
show error like this:
failed parsing config: ./config.yml: yaml: unmarshal errors:
line 41: field enabled not found in type aggregation.Config. Use
-config.expand-env=true
flag if you want to expand environment variables in your config file
then I tried like this:
root@iZhp33cq6mvrjo8mzatgrmZ:/etc/loki# loki --config.file=./config.yml --config.expand-env=true
failed parsing config: ./config.yml: yaml: unmarshal errors:
line 41: field enabled not found in type aggregation.Config
this is the config.yml
:
root@iZhp33cq6mvrjo8mzatgrmZ:/etc/loki# cat config.yml
auth_enabled: false
server:
http_listen_port: 3100
grpc_listen_port: 9096
log_level: debug
grpc_server_max_concurrent_streams: 1000
common:
instance_addr: 127.0.0.1
path_prefix: /tmp/loki
storage:
filesystem:
chunks_directory: /tmp/loki/chunks
rules_directory: /tmp/loki/rules
replication_factor: 1
ring:
kvstore:
store: inmemory
query_range:
results_cache:
cache:
embedded_cache:
enabled: true
max_size_mb: 100
schema_config:
configs:
- from: 2020-10-24
store: tsdb
object_store: filesystem
schema: v13
index:
prefix: index_
period: 24h
pattern_ingester:
enabled: true
metric_aggregation:
enabled: true
loki_address: localhost:3100
ruler:
alertmanager_url: http://localhost:9093
frontend:
encoding: protobuf
# By default, Loki will send anonymous, but uniquely-identifiable usage and configuration
# analytics to Grafana Labs. These statistics are sent to https://stats.grafana.org/
#
# Statistics help us better understand how Loki is used, and they show us performance
# levels for most users. This helps us prioritize features and documentation.
# For more information on what's sent, look at
# https://github.com/grafana/loki/blob/main/pkg/analytics/stats.go
# Refer to the buildReport method to see what goes into a report.
#
# If you would like to disable reporting, uncomment the following lines:
#analytics:
# reporting_enabled: false
does anyone facing the same issue? This is the loki version:
root@iZhp33cq6mvrjo8mzatgrmZ:/etc/loki# loki --version
loki, version 3.3.0 (branch: k227, revision: 19bbc448)
build user: root@bbfd3492a6b4
build date: 2024-11-19T11:25:17Z
go version: go1.23.1
platform: linux/amd64
tags: netgo
I tried to print the ascii charactor and seems no special charactor:
root@iZhp33cq6mvrjo8mzatgrmZ:~# cd /etc/loki
root@iZhp33cq6mvrjo8mzatgrmZ:/etc/loki# awk 'NR>40 && NR < 43' config.yml | od -c
0000000 e n a b l e d : t r u
0000020 e \n l o k i _ a d d r e
0000040 s s : l o c a l h o s t : 3 1
0000060 0 0 \n
0000063
Dolphin
(791 rep)
Nov 26, 2024, 02:10 PM
• Last activity: Nov 27, 2024, 05:54 AM
1
votes
2
answers
6941
views
Replace value in yaml file using yq
I am using yq version 4.34.1 in powershell. I try to replace the value of `.spec.source.targetRevision` in `target.yaml` with the newer value from a variable `$newTargetRevision`. So, what I am doing now is as follows. $newTargetRevision = "v1.1.1-1" yq -i '.spec.source.targetRevision = "$newTargetR...
I am using yq version 4.34.1 in powershell.
I try to replace the value of
.spec.source.targetRevision
in target.yaml
with the newer value from a variable $newTargetRevision
. So, what I am doing now is as follows.
$newTargetRevision = "v1.1.1-1"
yq -i '.spec.source.targetRevision = "$newTargetRevision"' target.yaml
What I have got is as follows.
spec:
source:
targetRevision: &default $newTargetRevision
I expect to get:-
spec:
source:
targetRevision: &default v1.1.1-1
I also tried removing double quotes from $newTargetRevision
as follows, but the value in the yaml file is not updated at all.
yq -i '.spec.source.targetRevision = $newTargetRevision' target.yaml
I try many things but without success. Can you please suggest?
Thanks
Rexagon
(9 rep)
Feb 29, 2024, 03:33 PM
• Last activity: Aug 22, 2024, 10:01 PM
2
votes
1
answers
1323
views
replace a value in yaml using yq and sed
I am trying to replace a value for key ipAddress using sed for the below yaml block: ```yaml networkInterfaces: - network: id: network-1111 ipAddress: 192.168.0.0 ``` The command I tried: `sed -i 's/\(.*ipAddress:.*\)/ipAddress: 192.168.0.1/g' filename.yaml` This actually replaced the text, but it d...
I am trying to replace a value for key ipAddress using sed for the below yaml block:
networkInterfaces:
- network:
id: network-1111
ipAddress: 192.168.0.0
The command I tried: sed -i 's/\(.*ipAddress:.*\)/ipAddress: 192.168.0.1/g' filename.yaml
This actually replaced the text, but it didn't nest the key under networkInterfaces; instead, it placed it in the main block.
Output after SED
networkInterfaces:
- network:
id: network-1834
ipAddress: 192.168.0.1
I tried yq
yq -i '.networkInterfaces.ipAddress = "192.168.0.0"' filename.yaml
... that resulted in an error:
cannot index array with 'ipAddress' (strconv.ParseInt: parsing "ipAddress": invalid syntax)
I'm looking to replace the value for ipAddress.
Purushotham Tumuluri
(21 rep)
Apr 10, 2024, 08:04 PM
• Last activity: Aug 3, 2024, 11:16 PM
2
votes
3
answers
3528
views
using yq to base64 encode k8s secret values
I have a simple secret.yaml file: ``` env: USERNAME: user PASSWORD: pass ``` i'm trying to use yq / jq to encode the values for creating k8s secret, so my final result should be: ``` apiVersion: v1 kind: Secret metadata: name: my-service type: Opaque data: USERNAME: PASSWORD: ``` i was trying to use...
I have a simple secret.yaml file:
env:
USERNAME: user
PASSWORD: pass
i'm trying to use yq / jq to encode the values for creating k8s secret, so my final result should be:
apiVersion: v1
kind: Secret
metadata:
name: my-service
type: Opaque
data:
USERNAME:
PASSWORD:
i was trying to use:
yq r secret.yaml ".env" -j | jq -r ' to_entries[] | "\(.value)" | @base64'"
which gave me the base64 encoded values, but i'm failing to insert the encoded values to the final output.
i'm trying to avoid using loops but if i won't find a clean solution i'll use it.
please assist.
Jonathan Benisti
(23 rep)
Sep 30, 2020, 04:57 PM
• Last activity: Jun 26, 2024, 03:01 AM
3
votes
2
answers
11683
views
Bash variable substitution into yq command
Given a YAML file, `example.yaml`: node: sub_node: get_this: I'd like to get a variable containing `get_this` using Mike Farah's `yq` and the string `sub_node` yaml="$(cat example.yaml)" nodename=sub_node sub_yaml= "$(echo "$yaml" | yq -r '.$nodename' )"; # also tried -> sub_yaml= "$(echo "$yaml" |...
Given a YAML file,
example.yaml
:
node:
sub_node:
get_this:
I'd like to get a variable containing get_this
using Mike Farah's yq
and the string sub_node
yaml="$(cat example.yaml)"
nodename=sub_node
sub_yaml= "$(echo "$yaml" | yq -r '.$nodename' )";
# also tried -> sub_yaml= "$(echo "$yaml" | yq -r '.'"$nodename" )";
Note this is a contrived example, in reality, the sub_node
string is not known in advance so I need to substitute the $nodename
string.
I can't seem to figure out how to escape out of the single quote query string required by yq
.
How might I do this?
Lee
(549 rep)
Mar 13, 2023, 11:47 AM
• Last activity: Apr 23, 2024, 05:29 PM
1
votes
2
answers
944
views
Executing `yq`, but `jq` gets executed
I am very confused. I installed the Debian package `yq` But if I call it, `jq` gets executed: ``` root@rescue ~ # echo '{"key": "value"}' | yq -p=json jq: Unknown option -p=json Use jq --help for help with command-line options, or see the jq manpage, or online docs at https://stedolan.github.io/jq `...
I am very confused.
I installed the Debian package
yq
But if I call it, jq
gets executed:
root@rescue ~ # echo '{"key": "value"}' | yq -p=json
jq: Unknown option -p=json
Use jq --help for help with command-line options,
or see the jq manpage, or online docs at https://stedolan.github.io/jq
root@rescue ~ # cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/ "
SUPPORT_URL="https://www.debian.org/support "
BUG_REPORT_URL="https://bugs.debian.org/ "
guettli
(1589 rep)
Apr 8, 2024, 09:27 AM
• Last activity: Apr 8, 2024, 01:46 PM
2
votes
2
answers
3362
views
Change value in array using yq from mike farah
In my yaml file I have this persons array (it only has one element always) ```yaml persons: - name: mario version: 1.0.0 city: Madrid ``` how can I replace city to any other value using yq ?
In my yaml file I have this persons array (it only has one element always)
persons:
- name: mario
version: 1.0.0
city: Madrid
how can I replace city to any other value using yq ?
Andre Silva
(37 rep)
Nov 14, 2023, 11:28 AM
• Last activity: Feb 11, 2024, 11:15 AM
0
votes
3
answers
4744
views
Parse yaml file without using outside tool
I am new to bash, dragged into a problem where I need to update some dynamic parameters in a yaml file Based on query (`search4.subsearch1.name`), i need to update ```lang-none name: old_name ``` into ```lang-none name: new_name ``` * Here is the sample file: ```lang-none search1: name: name1 pass:...
I am new to bash, dragged into a problem where I need to update some dynamic parameters in a yaml file
Based on query (
search4.subsearch1.name
), i need to update
-none
name: old_name
into
-none
name: new_name
* Here is the sample file:
-none
search1:
name: name1
pass: pass1
date: date1
#these are just commented texts
search2:
#Adding few more commented lines
myname: somename
name: name2
pass: pass2
someotherparam: param1
search3:
nameAndSurname: NS
namingConv: true
varSet: P3
search4:
#Again adding some special name: strings here
myname: somename1
name: new_name
pass: new_pass
ptherparam1: T3
subsearch1:
#Again adding some special name strings here
myname: somename2
name: old_name
pass: pass2
ptherparam1: param3
search5:
#Again adding some special name strings here
var1: value1
name: some_name
pass: some_pass
So based on query (search4.subsearch1.name
), I need to update name: old_name
into name: new_name
* Expeced output:
-none
search4:
#Again adding some special name: strings here
myname: somename1
name: new_name
pass: new_pass
ptherparam1: T3
subsearch1:
#Again adding some special name strings here
myname: somename2
name: new_name
pass: pass2
ptherparam1: param3
Tried with awk
and sed
but that did not work:
lineNR=$(awk "/\
g_jha
(19 rep)
Feb 10, 2021, 12:06 PM
• Last activity: Feb 9, 2024, 05:12 PM
0
votes
1
answers
202
views
yamlfix not using configuration + (neo)vim usage
I'm using yamlfix with [ale](https://github.com/dense-analysis/ale) in vim. I followed [these steps](https://lyz-code.github.io/yamlfix/) because I wanted to remove the automatic "---" adding on top of the file every time I save my work (and some others default configurations). For some reason, the...
I'm using yamlfix with [ale](https://github.com/dense-analysis/ale) in vim.
I followed [these steps](https://lyz-code.github.io/yamlfix/) because I wanted to remove the automatic "---" adding on top of the file every time I save my work (and some others default configurations).
For some reason, the file is correctly fixed, but my configuration is skipped..
So I decided to try with CLI in order to test my config.
yamlfix exits without error, fixes my file, but is completely skipping my configuration..
The configuration is in ~/pyproject.toml:
# pyproject.toml
[tool.yamlfix]
explicit_start = false
The command is
yamlfix -c ~/pyproject.toml file.yaml
Do I miss something ? Do I need something more ?
Corentin Michel
(3 rep)
Dec 22, 2023, 06:49 AM
• Last activity: Dec 22, 2023, 01:45 PM
0
votes
1
answers
2900
views
Add content to yaml file using yq from mike farah
This is a basic question but I am struggling to make this work as I have no experience in bash. Lets say I have a directory directory_1 and inside this directory I have cen1.yaml and cen2.yaml. cen1.yaml has a field called name ```yaml name:xxxx ``` and cen2.yaml has content that can vary (example)...
This is a basic question but I am struggling to make this work as I have no experience in bash.
Lets say I have a directory directory_1 and inside this directory I have cen1.yaml and cen2.yaml. cen1.yaml has a field called name
name:xxxx
and cen2.yaml has content that can vary (example)
service:ser1
image:
field1:field1
field2:field2
.
.
.
In the first iteration I have an empty final.yaml. But I want this file to have the name from cen1.yaml and all content from cen2 should go under name like this this.
xxxx:
service:ser1
image:
field1:field1
field2:field2
.
.
.
Next I will clone another directory with same file names (cen1.yaml and cen2.yaml). Cen1.yaml again has name field
name:another
and cen2.yaml will have its own content.
tv:lcd
name:
field1:field1
field2:field2
.
.
.
Now I need to append to the file that already exists keeping the same structure
xxxx:
service:ser1
image:
field1:field1
field2:field2
.
.
.
another
tv:lcd
mount:
field1:field1
field2:field2
.
.
.
So I need a command that works for both cases when file is empty and it writes the first iteration, or when the file already has content and it will append to it. How can I achieve this?
Andre Silva
(37 rep)
Nov 8, 2023, 05:56 PM
• Last activity: Nov 9, 2023, 07:32 AM
4
votes
3
answers
476
views
How to merge these commands into one?
This is what I am wanting to do: Convert a folder of HTML files into markdown, also copying over the the XML metadata of each of the HTML files by converting into YAML. I have done research and came across the following commands: 1. `find . -name \*.md -type f -exec pandoc -o {}.txt {} \;` * [This w...
This is what I am wanting to do:
Convert a folder of HTML files into markdown, also copying over the the XML metadata of each of the HTML files by converting into YAML.
I have done research and came across the following commands:
1.
find . -name \*.md -type f -exec pandoc -o {}.txt {} \;
* [This was found here](https://stackoverflow.com/questions/10323317/batch-processing-pandoc-conversions) , and it is a command that works and uses pandoc, however the file extentions are ".html.md" not ".md"
2. find / -name "*.md" -type f -exec sh -c 'markdown "${0}" > "${0%.md}.html"' {} \;
* [This was found here.](https://unix.stackexchange.com/questions/43669/use-find-command-to-convert-markdown-files-to-html) This apparently takes away the ".html.md" and turns into ".md", but it does not use pandoc.
3. pandoc -f html -t markdown -s input.html -o output.md
* [This was found here.](https://stackoverflow.com/questions/22866498/use-pandoc-to-create-yaml-metadata-from-html-meta-tags?rq=1) This is the pandoc command that apparently copies over the metadata and turns it into YAML, however it does not work on a folder of files, only on open
What I need is to have one single command that uses pandoc, gives the converted files the ".md." extension and not .html.md, and converts the XML metadata into YAML. All of this can be achieved using these three commands, they just need to be merged into one single command.
st john smith
(61 rep)
Mar 14, 2015, 03:35 AM
• Last activity: Oct 19, 2023, 11:42 AM
6
votes
2
answers
6543
views
Tool for manipulating YAML files?
We want to implement a workflow that includes having YAML configuration files where we wish to change some of the contents before actually using them, and we are looking for a good command line tool to do this. This can be as simple as setting a target-specific value (like an URL) in an existing nod...
We want to implement a workflow that includes having YAML configuration files where we wish to change some of the contents before actually using them, and we are looking for a good command line tool to do this.
This can be as simple as setting a target-specific value (like an URL) in an existing node, but preferably would be able to add or modify whole blocks of the YAML file. In a perfect world, I would like something as powerful as the axis in XSLT.
We will use this with Maven in Docker files, where we prefer Debian-based images, but not a strict requirement.
Thorbjørn Ravn Andersen
(1064 rep)
Nov 4, 2019, 11:36 AM
• Last activity: Oct 18, 2023, 01:18 PM
Showing page 1 of 20 total questions