I have a text file that contains:
toto.titi.any=val1
toto.tata.any=val2
toto.tete.any=val2
How to extract titi
, tata
and tete
from this file.
Should be some sthing like that
$ cat myfile.txt | sed '......'
and the output should be
titi
tata
tete
Do you really need
sed
? You could usecut
:awk/cut would be better choice for this problem.
here is the sed line and grep option:
display second value between dot from line having at least 2 dot inside
awk
andcut
are best for thisyou can also read the file line by line, and print out the portion needed.
With awk you can do: