I have a file with a lot of lines like this/item/pubDate=Sun, 23 Feb 2014 00:55:04 +010If I execute this echo /item/pubDate=Sun, 23 Feb 2014 00:55:04 +010 | grep -Po (?<=\=).*Sun, 23 Feb 2014 00:55:04 +010I get the correct date (all in one line). Now I want to try this with a lot of dates in a xml file. I use this and it's ok. xml2 < date_list | egrep pubDate | grep -Po (?<=\=).*Fri, 22 Jan 2016 17:56:29 +0100Sun, 13 Dec 2015 18:33:02 +0100Wed, 18 Nov 2015 15:27:43 +0100...But now I want to use the date in a bash program and I get this outputfor fecha in $(xml2 < podcast | egrep pubDate | grep -Po (?<=\=).*); do echo $fecha; done    Fri,    22    Jan    2016    17:56:29    +0100    Sun,    13    Dec    2015    18:33:02    +0100    Wed,    18    Nov    2015    15:27:43    +0100I want the date output in one line (in variable fecha) how the first and second examples but I don't know how to do it. 
for loop over input lines
bash;text processing;for
Do it this way instead:while IFS= read -r fecha; do    echo $fechadone < <(xml2 < podcast | egrep pubDate | grep -Po (?<=\=).*)Bash will separate words to loop through by characters in the Internal Field Separator ($IFS). You can temporarily disable this behavior by setting IFS to nothing for the duration of the read command. The pattern above will always loop line-by-line.<(command) makes the output of a command look like a real file, which we then redirect into our read loop.$ while IFS= read -r line; do echo $line; done < <(cat ./test.input)Fri, 22 Jan 2016 17:56:29 +0100Sun, 13 Dec 2015 18:33:02 +0100Wed, 18 Nov 2015 15:27:43 +0100