HI text like below but i have to find out % details.
[ /home/oracle ]
oracle@test.local > df -h | grep /u02
20G 8.9G 11G 46% /u02/oradata/rhlab
9.9G 1.4G 8.6G 14% /u02/oraredo/rhlab
[ /home/oracle ]
oracle@test.local >
i want out put like 46 ,14
could you please help on this
Regards,
Raj
Did you tried using Split function?
i tried, but s many values are coming in the output
lavint
June 28, 2018, 2:06pm
4
Hi,
You can use regular expression:
(?<=(G))(\s\d+)(?=(%))
I don’t know how to trim off the space in front of the 46 and 14 within that regex though…can someone help?
Thanks
Lavina
If the % occurs only two times, then it can be extracted using indexOf and substring and lastindexof and substring.
Hi! @lavint can you please message me some links from where I can study Regex. I don’t know how to use them.
Thanks in Advance
lavint
June 28, 2018, 3:53pm
7
yes… we can use trim. but I am hoping to do it within the regex if anyone knows how~
lavint
June 28, 2018, 3:54pm
8
Hello @Niket_Ghai ,
I am also fairly new to regex but I found this website which is quite helpful to test. It also explains what the expression is doing:
Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET.
hope it helps
Lavina
1 Like
niteshn
(Nitesh)
June 28, 2018, 5:11pm
9
1 Like
i need output 46 or 14 based on /u02/oradata/
could you please help on this regex code
loginerror
(Maciej Kuźmicz)
July 11, 2018, 1:28pm
11
Hi @rajsekhar
This should select what you want:
\d{2}(?=%)
It selects two digits before the % sign.
If you use it with Matches activity, it will return an IEnumerable with the results.
3 Likes
thanks for your input, i need data from multiple line items based on /U02/oradata/
loginerror
(Maciej Kuźmicz)
July 11, 2018, 1:34pm
13
You can extend it by simply including the full line after the % sign (you have to escape the forward slash sign though), like this:
\d{2}(?=% \/u02\/oradata\/rhlab)
This should select any two digits before the:
% /u02/oradata/rhlab
thank very much for your help
/u02/oracle/oradata/OREPOS/datafile/o1_mf_system_d8hocz2r_.dbf
from the test i need 3 separate variables
1.u02
2. oradata
3. o1_mf_system_d8hocz2r_.dbf
could you please help me on this
Can you clarify your question, please?
@loginerror nice help with the Regex!
i need to capture 3 values from the given line item
Line item is - “/u02/oracle/oradata/OREPOS/datafile/o1_mf_system_d8hocz2r_.dbf”
output of 3 values are
1.u02
2. oradata
3. o1_mf_system_d8hocz2r_.dbf
thanks for your help. i got it
using arrstring.GetValue(1).ToString