I have a bash command which the result is something like this in my file:
sm-apolo: 2.1-835
sql-apolo: 1.0-2
srmq-processor: 1.0-214
I want to get a result of all items that have sql at the start and only the first part before ":" so need the second part to be removed. Then I want to use the result in choiceParam in Jenkins pipeline to be shown as a drop-down list. If I run something like this:
names = sh (script: "A command here | grep sql", returnStdout: true).trim()
names_list = names.trim().tokenize("\n")
In the drop-down I get
sql-apolo: 1.0-2
How I can get rid of everything after the name including ": 1.0-2" to show up in the drop down list? something like:
sql-apolo
sql-sxdf
sql-pokf