I would like to make a parser with just one line and break a string into several variables. In the string I will parse, the default is that each field is separated by a comma.
On several lines, the code to do what I want would be like this:
hostname='echo $tripa | cut -d, -f1'
ip='echo $tripa | cut -d, -f2'
serial='echo $tripa | cut -d, -f3'
Is there a way to do this in just one line (without repeating the command cut
several times, one for each variable)?