0

I want to get the latets version number from this website: https://www.mailpiler.org/wiki/download

so I do a curl to get the content and then just use a pipe to search for the string using grep curl https://www.mailpiler.org/wiki/download | grep piler-

but this way I get the whole line like this: <a href="https://bitbucket.org/jsuto/piler/downloads/piler-1.3.12.tar.gz" class="urlextern" title="https://bitbucket.org/jsuto/piler/downloads/piler-1.3.12.tar.gz" rel="ugc nofollow">piler-1.3.12</a> (~3.3 <abbr title="Megabyte">MB</abbr>), 2022.05.28.

now.. how can I remove everythign but the version number (1.3.12)?

uSlackr
  • 6,412
  • 21
  • 37

1 Answers1

0

With awk you can use command like this:

curl -k -s  https://www.mailpiler.org/wiki/download |awk -F'[-".]' '/piler-/ {OFS=".";print $4,$5,$6}'

you do not need grep because awk can act on similar way.

Romeo Ninov
  • 5,263
  • 4
  • 20
  • 26