My file contains data as indicated below:
{ "any1", "aaa.bbb.ccc.1.ddd", "var1" }
{ "any2", "aaa.bbb.ccc.1.eee", "toto" }
{ "an42", "aaa.bbb.ccc.1.fff", "titi" }
{ "an47", "aaa.bbb.ccc.2.eee", "var3" }
{ "any7", "aaa.bbb.ccc.2.ddd", "var12" }
{ "a789", "aaa.bbb.ccc.2.fff", "var14" }
{ "any1", "xxx.yyy.zzz.1.ddd", "var1" }
{ "any2", "xxx.yyy.zzz.1.eee", "toto" }
{ "an42", "xxx.yyy.zzz.1.fff", "titi" }
I want to extract the all indexes of the prefix "aaa.bbb.ccc"
So the command should return
linux# command
1
2
How I can make that with sed
, awk
, grep
, sort
?