Help with shell script

Hi,

Can someone help me with a shell script, here is the requirement...

I had one text file (new.txt) and it contains

rows:832
columns:832
layers:1
xres:
yres:
zres:0.5
mrows:12
mcolumns:17
mrowres:700
mcolumnres:700
sections:150
sectionres:100
channels:1

I want to print the output (values) only in this format below

rows,columns,mrows,mcolumns,sections
ie 832,832,12,17,150

Hi, this should get you started:

while IFS=: read label val
do
  echo "\$label contains \"$label\" and its value is $val"
done < new.txt

Hi Scrutinizer,

Thanks for your reply.

I need a small help.I want to print only the values of rows,columns,mrows,mcolumns,sections from the entire contents.

output:

832,832,12,17,150

Hi, try something like this in the loop

case $label in
  rows|columns|mrows|mcolumns|sections)
      printf "%s\n" "$val" 
esac

Thanks Scrutinizer