« Back to Index
[Increment parsed number within a pipeline sub shell] When you need the next available port number
View original Gist on GitHub
Tags: #buzzfeed #bash
Increment parsed number within a pipeline sub shell.sh
egrep -roh 'port: \d{5}' **/service.yml | sort | tail -n 1 | egrep -o '\d{5}' | xargs -I {} bash -c 'echo $(("$@" + 1))' _ {}