Using relevance filters in reading a .dat file in Solaris

(imported topic written by VipulSri)

Hello,

I am currently working on extracting information which I have pushed into a .dat file on Solaris OS. As per the inspector guide I am trying to grab a line with applying a filter that it starts with or starting with “xyz” but it seems to be not working for me.

For .eg.

lines whose (it starts with “Drive”) of file “storage.dat” of folder “__HardwareInfo” of client folder of site whose (name of it starts with “BES Inventory and License”)

Can somebody help me with this?

Thanks in advance.

Vipul

(imported comment written by martinc)

When you say that it is not working, what is happening?

This is from the file that is written by the “Solaris Hardware Probe”, is that correct? Does the file exist on the system you are trying this on?

(imported comment written by VipulSri)

Hi Martin,

Sorry for the delay in response.

I am using the same relevance as mentioned in “Hardware Information -Solaris” .

e.g

parenthesized part 1 of (match (regex “Platform:(.+)”) of it) of lines whose (it starts with “Platform:”) of file “general.dat” of folder “__HardwareInfo” of client folder of site whose (name of it starts with “BES Inventory and License”)

However the general.dat contains only one line.

What I am doing is that I have placed another file in “/tmp/” and this file is “test.txt” which has information like shown below:

NAME: The Zip compression library

VERSION: 11.10.0,REV=2005.01.08.01.09

VENDOR:  Oracle Corporation



  NAME:  Solaris Zones (Root)

VERSION: 11.10.0,REV=2005.01.21.16.34

VENDOR:  Oracle Corporation



  NAME:  Solaris Zones (Usr)

VERSION: 11.10.0,REV=2005.01.21.16.34

VENDOR:  Oracle Corporation

Now if I change the relevance mentioned above to read all the lines which starts with “NAME:” and only give me the output as the part after colon.

I am getting the error as " Singular expression refers to nonexistent object."

Please help me with this.

Thanks

Vipul

(imported comment written by martinc)

This might work for you

q: parenthesized parts 1 of (matches (regex “NAME:(.+)”) of it) of lines whose (it contains “NAME:”) of file “/tmp/test.txt”

A: The Zip compression library

A: Solaris Zones (Root)

A: Solaris Zones (Usr)

There are two problems with the syntax:

  1. Since the line is looking for something that begins with “NAME:” the only line that will display is the first one as the others have spaces before the “NAME:”. This is why I changed it to “contains”

  2. Since there are multiple possible returns, the “parenthesized part” had to be changed to “parenthesized parts”

Now I am not sure if this is the final format you want to see, but at least it is presenting the data you want :slight_smile:

(imported comment written by VipulSri)

Great!

That worked exactly the way I wanted…thanks a tonne Martin. I wasted hours for this silly mistake of mine.

Cheers!!!