My personal blog| anagogistis
When parsing a string that is divided by a separator char, getting the first N values OR last N values is a common scenario when dealing with: IP address separated by periods, e.g. “10.11.12.13” File path separated by forward slash “/tmp/myfolder/subpath1/subpath2/subpath3” Fully qualified domain separated by periods “sub1.sub2.my.domain.com” Getting first N values Getting the first ... Bash: extracting first or last N octets, paths, or domain from string with fixed separator| Fabian Lee : Software Engineer
The dig utility is convenient for doing manual DNS resolution from your system. Additionally, it uses the same OS resolver libraries as your applications which makes it more accurate than nslookup for emulating application issues and its output is more suitable for machine parsing. # ensure 'dig' is installed sudo apt install -y bind9-dnsutils dig ... Bash: using dig for reverse DNS lookup by IP| Fabian Lee : Software Engineer