![]() Terraform: fixing error “querying Cloud Storage failed: storage: bucket doesn’t exist”.Git: create a new empty branch with no history or commits.Kubernetes: creating TLS secrets with kustomize using embedded or external content.Terraform: terraform_remote_state to pass values to other configurations.Kubernetes: evaluating full readiness of deployment, daemonset, or pod.Ansible: resolving ‘could not initialize the preferred locale: unsupported locale setting’.Terraform: error removing module containing legacy provider block, ‘Provider configuration not present’.Bash: decoding a JWT from the command line with jq.Kubernetes: fixing x509 certificate errors from metric-server on K3s cluster.Kubernetes: implementing and testing a HorizontalPodAutoscaler.Kubernetes: HorizontalPodAutoscaler evaluation based on Prometheus metric.Kubernetes: patching container arguments array with kubectl and jq.Helm: discovering Helm chart releases installed into Kubernetes cluster.Docker: QEMU emulation to run arm64 images from native amd64 host.Docker: building multi-platform images that use fat manifest list/index.Github: automated build and publish of multi-platform container image with Github Actions.Helm: manually publishing Helm repo on Github using chart-releaser.Helm: automated publishing of Helm repo with Github Actions.Git: find branch name of newly applied tag.GitLab: automated build and publish of multi-platform container image with GitLab pipeline.GitLab: passing values between two jobs in pipeline.Bash: extracting first or last N octets, paths, or domain from string with fixed separator.GitLab: add files to source repository as part of GitLab pipeline. ![]() Bash: change into directory just created with git clone.GitLab: invoking Ansible from a GitLab pipeline job.GCP: quota project error when invoking GCP API using ADC application-default.GitLab: self-managed runner for CI/CD jobs on GCP VM instances.GitLab: Continuous Deployment with Agent for Kubernetes and GitLab pipeline.GitLab: least privilege for Kube-API calls from GitLab Agent for Kubernetes.Bash: fixing SSH authentication error “bad ownership or modes for file/directory”.Vault: HashiCorp Vault deployed into Kubernetes cluster for secret management.Vault: Spring Boot web app using Spring Cloud Vault to fetch secrets.Bash: calculate sum from a list of numbers.Vault: NodeJS Express web app using node-vault to fetch secrets.Ansible: resolving error “Invalid callback for stdout specified: yaml”.Vault: JWT authentication mode with multiple roles to isolate secrets.Bash: schedule a command that will be run at reboot using cron.minikube: exposing a deployment using ingress with secure TLS.Vault: synchronizing secrets from Vault to Kubernetes using Vault Secrets Operator.Ubuntu: resolving systemd error, “Start request repeated too quickly”.Bash: indirect reference to evaluate a variable value.Linux: sed to cleanup json that has errant text surrounding it.Bash: Outputting text in color for readability.Bash: Fixing an ASCII text file changed with Unicode character sequences.Ansible: regex capture groups with lineinfile to preserve yaml indentation.Bash: Using BASH_REMATCH to pull capture groups from a regex. ![]() You can use brute force LookBehind if you need variable length LookBehind, but does not seem worth it when \K does a better job grep -Po "(?:(?<= /?\"])*" greptest.txt Grep -P does not support output of any capture group but first, but pcregrep can do it $ sudo apt-get install pcregrep -y # fails because LookBehind requires static string length $ grep -Po "(?)[^” as well as “”, it would be tempting to believe we could add “s?” to the end of the tag name. # use non-captured LookBehind to isolate value But even easier would be using a LookBehind that does not capture the starting tag at all. # a bit smarter, by taking characters until '[^ /my/dataįrom this imperfect parse, you might use some combination of sed/awk/cut to get to your ultimate atomic value. Using the -E extended regular expression flag you could attempt to isolate the value. In this article, I’ll show how LookBehind and LookAhead regular expression support can provide enhanced parsing abilities to your shell scripts.įor example, consider an xml file “test.xml” with the contents: Grep has support for Perl compatible regular expressions (PCRE) by using the -P flag, and this provides a number of useful features.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |