Question: Input:

```
blahŤfoobar1Ťblah

```

Desired output:

```
foobar1

```

I want to get the text between two "Ť" characters.

Assume there will always be either 0 or 2 "Ť" characters, to make things easier.

I tried the following, but I don't know how to get it to know which occurrence it is:

```
echo "blahŤfoobar1Ťblah" | sed -n '/Ť/,/Ť/p'

```

Answer: 
`awk` seems to be the easiest to use for this problem:

```
$ echo "blahŤfoobar1Ťblah" | awk -FŤ '{ print $2 }'
foobar1

```
1. Using `bash` :

```
$ test='blahŤfoobar1Ťblah'
$ spamegg="${test#*Ť}"
$ echo "${spamegg%Ť*}"
foobar1

```

Here we have used the `bash` parameter expansion get the desired substring.

	* `"${test#*Ť}"` will remove the portion `blahŤ` , so the variable `spamegg` will have `foobar1Ťblah`
	* `${spamegg%Ť*}` will remove the trailing `Ťblah`, so we would get the output `foobar1`
2. Using `grep` :

```
    $ echo "blahŤfoobar1Ťblah" | grep -Po '(?<=Ť)[^Ť]+(?=Ť)'
    foobar1

```

	* `-P` implements the `perl` compatible Regex, `-o` prints only the matched portion
	* `(?<=Ť)` is the zero width positive look behind pattern ensuring there will be a `Ť` prior to the match
	* `(?=Ť)` is the zero width positive lookahead pattern ensuring there is a `Ť` following the match
	* `[^Ť]+` will match one or more characters between the two `Ť` characters.
3. Using `python` :

```py
$ python2 -c "print 'blahŤfoobar1Ťblah'.split('Ť')[1]"
foobar1

```

	* `split()` will split the string into list of fields separated by `Ť` and the we have printed the second element from the list.