Archive

field extraction

Explorer

/data/scripts/esx/outfile/dc1-ch1-esxi05.dca.com-vmnic0.txt

I need to extract the dc1-ch1-esxi05.dca.com-vmnic0 from the above string . How can i write regex for this .

Tags (1)
0 Karma
1 Solution

Communicator
(?<server_and_interface>[^\/]+)\.txt$

Here it is in action:

| makeresults | eval source="/data/scripts/esx/outfile/dc1-ch1-esxi05.dca.com-vmnic0.txt" | rex field=source "(?<server_and_interface>[^\/]+)\.txt$"

View solution in original post

Champion

Hi

Give a try

| makeresults 
| eval path="/data/scripts/esx/outfile/dc1-ch1-esxi05.dca.com-vmnic0.txt" 
| rex field=path "(?P<temp>.*(?=\.))" 
| rex field=temp "(?P<output>[^\/]+$)"
0 Karma

Communicator
(?<server_and_interface>[^\/]+)\.txt$

Here it is in action:

| makeresults | eval source="/data/scripts/esx/outfile/dc1-ch1-esxi05.dca.com-vmnic0.txt" | rex field=source "(?<server_and_interface>[^\/]+)\.txt$"

View solution in original post

Explorer

It worked . Thanks

0 Karma