Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • Given Nametoextract can be different, how do you expect to delimit it? Or is that not part of the question? Commented Oct 19, 2017 at 0:00
  • Right now the name to extract is being printed in the same line as the othername. For this question i am wondering how to get the : in front of the host name. Commented Oct 19, 2017 at 0:03
  • awk -F'[/|.]' '{gsub(/hostname[[:digit:]]/,""); print $2}' Commented Oct 19, 2017 at 0:04
  • Yup that worked for one of the packet capture files. It left a 0 at the end of the trailing. On the other (similar format the hostname changed only) i am getting numeric output of 66 only. I gave the code a go on another project and it filled a gap i had. Thanks so much. Commented Oct 19, 2017 at 0:21
  • I missed an * after [[:digit:]] to match more than one... Commented Oct 19, 2017 at 0:32