Need help to create shell script.

When i run the following command it shows me following o/p

# prtpicl -v -c temperature-sensor | sed -n '/T_TCORE/,/:name/ p' | grep
Temperature 61
Temperature 62

i want to put this command in shell script so that when i run the script it says
*********************
Proc1
Temperature 61
Proc2
Temperature 62
ProcN N depending on the no. of processors
Temperature
*********************

thats proc$ should keep on increasing with the no. of o/p from the above command.

I seems your grep pattern is missing in your example.

What happened to the grep?

prtpicl -v -c temperature-sensor | sed -n '/T_TCORE/,/:name/ p' | grep

You can do something like below on the output of your command

awk '{ print "Proc"NR"\n"$0; }' file

yes that worked the way i wanted thank you very much. :b:

# prtpicl -v -c temperature-sensor | sed -n '/T_TCORE/,/:name/ p' | grep :Temp |awk '{ print "Proc"NR"\n"$0; }'
Proc1
:Temperature 61
Proc2
:Temperature 61

But can u explain me awk '{ print "Proc"NR"\n"$0; }' this does..

I have the feeling that if you can give us the output of prtpicl, we can make it in one command.

Such as:

prtpicl -v -c temperature-sensor | awk -F: '/T_TCORE/,/name/ {if ($2~/^Temp/) {i++; print "Proc"i"\n"$0}}' urfile