Let's say my text file is like this
Person1 : movie1
(space and tab) : movie 2
(space and tab) : movie 3
(space and tab) : movie 4
I want to find for a particular movie, the actor. So here is how I am going about doing this.
Do a grep cat actors | grep 'movie3'
This will give me line 3 which is an empty line up unitl movie3 appears. So if somehow I can get the first line before this particular line which follows this pattern
grep '^[^ \t].'(does not start with a space)
it has to be the line with the actor's name in this movie.(I don't care about movie one there)
Is there any combination of sed/grep/awk which can help me do it in shell? I hope the question is clear.