I have a file with a lot of lines like this
/item/pubDate=Sun, 23 Feb 2014 00:55:04 +010
If I execute this
echo "/item/pubDate=Sun, 23 Feb 2014 00:55:04 +010" | grep -Po "(?<=\=).*"
Sun, 23 Feb 2014 00:55:04 +010
I 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 +0100
Sun, 13 Dec 2015 18:33:02 +0100
Wed, 18 Nov 2015 15:27:43 +0100
...
But now I want to use the date in a bash program and I get this output
for 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
+0100
I 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.
xml2 < date_list | egrep "pubDate" | grep -Po "(?<=\=).*" | while read fecha
...