I like the installer to download a file based on the IF condition returning true. False then do not download.

This is for MAC OS installer. During installation a text file is downloaded which has a file version number. The text file needs to be read for the version number in first line. If that version number is higher than only the download needs to take place.

How do i do that?

asked 26 May '13, 05:01

Codename%20K's gravatar image

Codename K
accept rate: 50%

You could use the below code:


answered 26 May '13, 14:52

juanjo's gravatar image

juanjo ♦♦
accept rate: 23%

Thanks. What does this mean "(^[^n]+).*" in the above code?

(29 May '13, 01:46) Codename K

It is used to take the first line of the text. I says: take all the first characters that are no new lines from the beginning of the text and capture them (enclosing them in parentheses so we can use them using \1) and match all others characters afterwards. That matches all the text in the file, and saves the first line to be available as \1. Then we use that \1 in the substitution.

(29 May '13, 03:13) juanjo ♦♦

Thanks. This is helpful.

(29 May '13, 03:27) Codename K
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 26 May '13, 05:01

Seen: 1,195 times

Last updated: 29 May '13, 03:27