Print numbers between two number ranges

Hi, I have a list.txt file with number ranges and want to print/save new all.txt file with all the numbers and between the numbers.

== list.txt ==
65936
65938
65942 && 65943
65945
65947 && 65949
65961
65963 && 65965
65966 && 65969
6597

after:
== all.txt ==
65936
65938
65942
65943
65945
65947
65948
65949
65961
65963
65964
65965
65966
65967
65968
65969
6597

Can you guy help me with this script in unix/linux (cygwin) ?

Thank you in advance.

BR,

try:

 
awk '{for (i=$1; i<=$NF ; i++) print i}' list.txt
 

tnx, but I am still missing the number between &&.

I receive:
65936
65938
65942
65943
65945
65947
65949
65961
65962
65963
65965
65966
65967
65968
65969
6597

sorry, try:

 
awk '{for (i=$1; i<=$NF ; i++) print i}' list.txt

rdrtx1 solution is most elegant one, here is a different approach:-

awk ' {
  for (i=1; i<=NF ; i++)
  {
    if ($i == "&&")
    {
      st=$(i-1);
      en=$(i+1);
      st++;
      while (st < en)
      {
         print st;
         st++;
      }
    }
    else
        print $i;
  }
}' list.txt
awk '{if(NF==1){print $1} else { for(Val=$1; Val<=$3; Val++) print Val  } } ' File_Name

---------- Post updated at 02:46 AM ---------- Previous update was at 02:27 AM ----------

Less Complex

awk '{for(Val=$1; Val<=$NF; Val++) print Val  } ' File_Name

Tnx you all very much :).

bipinajith I'm receiving error with your Code.:confused:

awk ' {
  for (i=1; i<=NF ; i++)
  {
    if ($i == "&&")
    {
      st=$(i-1);
      en=$(i+1);
      st++;
      while (st < en)
      {
         print st;
         st++;
      }
    }
    else
        print $i;
  }
}' list.txt

error received:

[~]$ awk  -f ./x/extract.awk
awk: ./x/extract.awk:1: awk ' {
awk: ./x/extract.awk:1:     ^ invalid char ''' in expression
awk: ./x/extract.awk:1: awk ' {
awk: ./x/extract.awk:1:     ^ syntax error

I Assume .awk file should be like this..

try

$ cat awk.awk
{
  for (i=1; i<=NF ; i++)
  {
    if ($i == "&&")
    {
      st=$(i-1);
      en=$(i+1);
      st++;
      while (st < en)
      {
         print st;
         st++;
      }
    }
    else
        print $i;
  }
}
$ awk -f awk.awk file
65936
65938
65942
65943
65945
65947
65948
65949
65961
65963
65964
65965
65966
65967
65968
65969
6597