Question: That is my code:

```py
chrome_driver_path = 'C:\Development\chromedriver.exe'
driver = webdriver.Chrome(chrome_driver_path)
driver.get('https://orteil.dashnet.org/cookieclicker/')

button = driver.find_element_by_css_selector('#bigCookie')
driver.implicitly_wait(5)

my_path = driver.find_element_by_xpath('/html/body/div[2]/div[2]/div[19]/div[3]/div[6]/div[2]')
content = my_path.get_attribute('div')
print(content)

```

What I would like to do, is I would like to get a number shown in the picture below:[![enter image description here](https://i.stack.imgur.com/SL77S.png)](https://i.stack.imgur.com/SL77S.png)

Now I tried to get that number with the ".text" method but then I searched and realized that I cant use it because it's not an actual value. I tried to convert it into an int so that I can use it. I found the `get_attribute` method( shown in the linked code how I used it ), but no matter if I try to pass in as a value the span, div, id, or class name it returns none.

My question is how can I get that number( shown in the picture ) to get it as a value so that I can use it as an int?

Answer: 
You don't need to group `:` in your pattern and use it in substitution.

You should keep it simple:

```sh
s='|abc:1.2.3|def|'
sed 's/:[^|]*//' <<< "$s"

|abc|def|

```

`:` matches a colon and `[^|]*` matches 0 or more non-pipe characters
***1st solution:*** With `awk` you could try following `awk` program.

```
awk 'match($0,/:[^|]*/){print substr($0,1,RSTART-1) substr($0,RSTART+RLENGTH)}' Input_file

```

***Explanation:*** Using `match` function of `awk`, where matching from `:` to till first occurrence of `|` here. So what `match` function does is, whenever a regex is matched in it, it will SET values for its OOTB variables named `RSTART` and `RLENGTH`, so based on that we are printing sub-string to neglect matched part and print everything else as per required output in question.

---

---

***2nd solution:*** Using `FPAT` option in GNU `awk`, try following, written and tested with your shown samples only.

```
awk -v FPAT=':[^|]*' '{print $1,$2}'  Input_file

```