Quantcast
Channel: Active questions tagged bash+awk - Ask Ubuntu
Viewing all articles
Browse latest Browse all 102

Extracting name between two delimiters via awk

$
0
0

I have a string like this

<user>@<server>:<port>:/foo/bar

and I would like to extract the user, server, port and directory.

The user can easily be extracted by

echo <string> | awk -F"@"'{print $1;}'

But the server lies within two different delimeters. Is this possible via awk?


Viewing all articles
Browse latest Browse all 102

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>