I'm a novice at manipulating text in bash and appreciate any suggestions!
I have a variable used early in a script that is formatted like this:
runlist=echo 10,19,25,32
The actual numbers and how many numbers there are listed out differ on various iterations. They will always be 2 digits each. I need the variable in this format for the first step they are used for. But later in the script, I'd like to print out these numbers to a temporary text file in a single column like this
cat tmp_runlist.txt
10
19
25
32
I tried using IFS=','
but found that it also modified the runlist variable, which is used again towards the end of the script. I've been exploring using cut
and awk
but need something that can be flexible in just grabbing the characters between the commas and not taking the commas before the carriage return.
Thanks in advance for your ideas :)