Print line 1 if line 3 matches of the output

Hi

I want to extend following command so that on the basis of "Branch: ****" on the third line I can grep and print name of the file on the first line.

cat .labellog.emd | grep DA2458A7962276A7E040E50A0DC06459 | cut -d " " -f2 | grep -v branch_name | xargs -I file <command to describe> file

Thanks!

Dear ezee,

My crystal ball is in the wash at the moment, so I have a few to questions pose in response first:-

  • Can you explain what you want to achieve a bit better?
  • Can we see some sample input and required output?
  • Is this homework/assignment? There are specific forums for these.
  • What have you tried so far?
  • What output/errors do you get?
  • What OS and version are you using?
  • What are your preferred tools? (C, shell, perl, awk, etc.)
  • What logical process have you considered? (to help steer us to follow what you are trying to achieve)

Most importantly, What have you tried so far?

There are probably many ways to achieve most tasks, so giving us an idea of your style and thoughts will help us guide you to an answer most suitable to you so you can adjust it to suit your needs in future.

We're all here to learn and getting the relevant information will help us all.

Thanks, in advance,
Robin