echo -e "GET /intl/en_ALL/images/logos/images_logo_lg.gif" | nc images.google.com 80 | sed -n -e '1,/^^M$/!p' > images.gif
HTTP/1.0 200 OK Content-Type: image/gif Last-Modified: Mon, 02 Apr 2012 02:13:37 GMT Date: Sun, 21 Apr 2013 00:09:16 GMT Expires: Sun, 21 Apr 2013 00:09:16 GMT Cache-Control: private, max-age=31536000 X-Content-Type-Options: nosniff Server: sffe Content-Length: 8561 X-XSS-Protection: 1; mode=block GIF89a^T^An^@÷ü^@^@s^K^C|^Nq^Z^Yl#%m-$s.(v/K~S<96>^E^_<9a>^F!<90>^V(© $¸^K'µ^V,<8d>+7±)8Ã^M*Ë^M+Ô^N-Ç^U+Ì^S,Ô^T-×^V.Û^Z/Í^]5Ü^W3Ý^[2á^Z/á^Y1â^[2Ü$5Ð*6ä"2ê%3ê*6î,6ì29ò38ô;<½^^V´r4ËX^EÒ\^@Ùi^AÜt^DÎt^Uây^B÷B>Æz'<9f>;C×6Fì9Dð:B<91>KP°NQ¤qS<94>qp¯nmÑNTôIH÷SNéMSöYTøe\ß\fÓjlðpløtj^A<82>^M^B<89>^O^C<8d>^Q^T<84>^_^A<93>^Q^A<9d>^T^H<99>^T^A£^U^G«^X^P®^Z^L²^\^Q¶^^^X<98>*'<94>6^Y¥+^W»!#¬/&²1-Á3S<86>ZW¦`]Çi¿<83>9Ú<86>^Tè<87>^Dì<94> ô<9a>^Eê<9a>^Qù¤^Gÿ¬^Fý* ÿ²í£^Xõ©^Tý¶^Vÿ»^\Ô<97>3î¯/þ¼#ÿÁ)ÿÆ7´<86>O<9a><89>s±<8f>m´ }Ý¡cÿÌHüÎWõÏp(<<9d> @
sed -n -e '1,/^[B]^M[/B]$/!p'
sed -n -e '1,/^[B]\r[/B]$/!p'
sed -n -e '/^GIF8[79]a/,$p'
paul78 wrote: » Ahh... This would have made a good question of the day
ChooseLife wrote: » In my case, sed -n -e '1,/^[B]^M[/B]$/!p' had to be replaced with its equivalent of sed -n -e '1,/^[B]\r[/B]$/!p' to work, I'm curious to know what is the reason for ^M representation of carriage return to work for hiddenknight821 but not for me.
hiddenknight821 wrote: » Interesting to see that \r worked for you. I can attest it didn't work on Mac OS X Snow Lion. In my previous post, I did the example using Ubuntu 12.04, and I just learned \r worked on Ubuntu as well. So, I guess \r is not an universal solution, but thanks for bringing that up as I just learned something new. I'm not sure why ^M didn't work for you, but I hope you used the CTRL-V and CTRL-M key combination rather than entering the literal characters.
hiddenknight821 wrote: » By the way, I must say your GIF regex was brilliant. I wasn't sure if it has a tag I can use as I was not familiar with it.