Shell

Use a Docker container to run a shell

If you need to run a shell script in a specific environment than your current host you can use a temporary Docker container and link it to the current directory. For example if you want to run a bash script on ubuntu you can store the script file in the current directory and start a temporary ubuntu container: $ docker container run --rm -v $(pwd):/root -it ubuntu /bin/bash Inside the container you can then access the script in the /root directory:
Read more

Extract XML node values using grep

To extract the value(s) of XML nodes with a specified name you can use grep and a regular expression: $ grep -oP "(?<=<mytag>)[^<]+" <file> To limit the number of nodes that are examined you can specify a maximum number: $ grep -oPm1 "(?<=<mytag>)[^<]+" <file>