how do i get a string closed?

kubecmd | awk -F[:] 'NR>1 { split($2,arr,"/");print arr[1]}'

For the first scenario, you can use awk as above. Use : as a field separator and then further split the second delimited piece on / into array arr printing the first element this array the

kubecmd | sed -En 's/(^.*Kubernetes master.*https:\/\/)(.*)(:.*$)/\2/p'

For the second scenario, use sed as above. Split the text into three sections and print the second section

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top