Take the 5th column, remove the opening closing quotation marks, and match the lines starting with HTTP//, https://, ftp://
* awk
Awk-f "," ' Str=gsub (/(^\ "*) | ( \ "*$)/," ", $ $) {if ($5~/(^http (s)?: \ \ /\/)| (^ftp:\/\/)/) print $} ' .. /data/t_video.csv >. /data/urls.csv
* PHP
<?php//awk-f "," ' Str=gsub (/(^\ "*) | ( \ "*$)/," ", $ $) {if ($5~/(^http (s)?: \ \ /\/)| (^ftp:\/\/)/) print $ "//... /data/t_video.csv >. /data/urls.csv$in = new Splfileobject ('.. /data/t_video.csv ', ' RB '), if (! $in) { throw new Exception (' Open file for read failed! ');} $out = new Splfileobject ('.. /data/urls.csv ', ' W '), if (! $out) { throw new Exception (' Open file for write failed! ');} $a = []; $videoURL = "; foreach ($in as $lineNum = = $line) { $a = explode (', ', $line); if (!isset ($a [4])) { continue; } $videoURL = $a [4]; if (7<strlen ($videoURL)) { $videoURL = Trim ($videoURL, "\" "); if (Preg_match ('/^[http:\/\/|ftp:\/\/|https:\/\/]/', $videoURL)) { $out->fwrite ($videoURL. php_eol);}}
Input
.. /data/t_video.csv
"9", "Other", "ULTIMATE PHOTO Guide", NULL, "Http://118.190.209.209/media/mp4/1.mp4", "http://118.190.209.209/media/png/ 1.png "," ULTIMATE PHOTO Guide "" 10 "," other "," the VERGE ", NULL," Http://118.190.209.209/media/mp4/2.mp4 ","/HTTP/ 118.190.209.209/media/png/2.the_verge.png "," The Verge "" 11 "," Other "," Microsoft Power BI ", NULL," http://118.190.209.209 /media/mp4/3.mp4 "," Http://118.190.209.209/media/png/3.png "," Microsoft Power BI "
Output
.. /data/url.csv
Http://118.190.209.209/media/mp4/1.mp4http://118.190.209.209/media/mp4/2.mp4http://118.190.209.209/media/mp4/3.mp4
Php/awk processing CSV