Created
September 3, 2018 11:52
-
-
Save halleshubham/8b010196d5b03e08db88d10d50e26d6c to your computer and use it in GitHub Desktop.
BASH: from lines of output of BASH command, parse host and port number.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while IFS= read -r line; | |
do | |
URL=$(echo $line | grep / | cut -d/ -f3) | |
HOST=$(echo $URL | grep : | cut -d: -f1) | |
PORT=$(echo $URL | grep : | cut -d: -f2) | |
# TO DO | |
done < <( cat <file.format> | grep <substring> ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment