Skip to content
This repository has been archived by the owner on Jun 1, 2021. It is now read-only.

Commit

Permalink
Split URLs into parts
Browse files Browse the repository at this point in the history
  • Loading branch information
joelpurra committed May 14, 2014
1 parent 01d9fd5 commit 2b214bf
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/extract/url/parts.sh
@@ -0,0 +1,23 @@
#!/bin/bash
set -e

read -d '' splitUrlToParts <<-'EOF' || true
def splitUrlToParts:
split("://") as $protocolParts
| {
url: .,
protocol: $protocolParts[0],
domain: ($protocolParts[1] | split("/")[0])
};
[
.[]
| if (. | type) == "string" then
splitUrlToParts
else
empty
end
]
EOF

cat | jq "$splitUrlToParts"

0 comments on commit 2b214bf

Please sign in to comment.