Hi Rupali,
readFile returns a String object with the entire contents of the file -
so you can parse it using stand java/groovy APIs.
.e.g.
you can chain a StringReader and Properties
https://docs.oracle.com/javase/7/docs/api/java/util/Properties.html#load(java.io.Reader)
http://docs.oracle.com/javase/8/docs/api/java/io/StringReader.html#StringReader-java.lang.String-
pseudo code...
def str = readFile name: 'somefile', charset : 'utf-8'
def sr = new StringReader(str)
def props = new Properties()
props.load(sr)
def foobar = props.getProperty('somepropname')
/James
On 27/11/2014 12:10, Rupali wrote:
Hi,
I tried reading file from workspace using *readFile* and then echo the
results. That works just fine. But I was unable to parse it and
retrieve specific values. Is there a way to parse the contents of this
file and read properties into variables?
File will contain key=value kind of entries.
Regards,
Rupali
--
You received this message because you are subscribed to the Google
Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/d50d9908-49e8-478d-8151-f8f19b804790%40googlegroups.com
<https://groups.google.com/d/msgid/jenkinsci-users/d50d9908-49e8-478d-8151-f8f19b804790%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Jenkins
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/54773171.2050003%40teilo.net.
For more options, visit https://groups.google.com/d/optout.