title: Groovy read file line by line and store it into list
body: <p>I have a file called <strong>apps.txt</strong> which has three app names in it</p>
  <p>frontendapp</p>
  <p>authorizationservice</p>
  <p>connectorservice*</p>
  <p>In jenkins pipeline i want to perform some operation on them one by one so i am trying to get them in groovy list using this code -</p>
  <pre><code>                    list = readFile.readFileLineByLine(&quot;${workspace}/apps.txt&quot;).collect {it}
                      for (item in list) {
                          println &quot;I need to perform some operations on files&quot;
                      }
  </code></pre>
  <p>But getting groovy.lang.MissingPropertyException.
  If i use file class like this - <code>list = new File(&quot;${workspace}/apps.txt&quot;).collect {it}</code> then it search for a file on Jenkins master node only and i get fileNotFoundException.</p>
  <p>If i use <code>list = readFile(&quot;${workspace}/apps.txt&quot;).collect {it}</code> then list gets values character by character. How i can get app names from apps.txt inorder to perform operation on each app.</p>