Skip to content

How to extract something out of a file after greping?

How can I extract group-3-vm1 after I do this grep? Here’s the result: Answer This awk command replaces the grep and tail commands while also extracting the text of interest: How it works -F'[:/]’ This sets the field separator to either a colon or a slash. /Tracking URL/{n=$4;} This looks for line…

Detect if a remote computer is Windows or Linux OS

I have IP Address and Server name of a remote computer. I am able to query WMI to get the OS version if the computer is running Windows but is there a way i can query the remote computer and get the OS version if the computer is not running Windows (Linux, Solaris)? Answer I guess Active Directory is going

Grepping Numbers With Decimal Places

I’m trying to figure out how to grep a time stamp read from a file that consists of a number with a decimal, but I can’t seem to get the output I’m looking for, any help would be great! Thanks in advance. Example: The result should be: What I’ve Tried: Answer you can use awk to split t…

Detecting the linux distribution from java

Is there a (preferably efficient, i.e. without executing binaries and parsing their outputs) way of detecting the Linux distribution in Java? As far as I know, System provides os.name, os.arch and os.version, which don’t seem to help. For a typical Ubuntu installation they get these values: os.name: amd…