             githubName = ""
         }
     } else if url.hasPrefix("http") { //(url =~ m#^http://([a-zA-Z0-9.\-\!\#]*)/#) {
-
-        source = F[0].stringByReplacingOccurrencesOfString("www.", withString: "", options: NSStringCompareOptions.LiteralSearch, range: nil) //  source =~ s/www[.]//;
+        
+        source = F[0].replacingOccurrences(of: "www.", with: "", options: NSString.CompareOptions.literal, range: nil) //  source =~ s/www[.]//;
     } else {
         source = url
         //    source =~ s/http:\/\///;
         //    my @F = split(/\//, url);
-
+        
         //    # my @F = split(source,'/');
         source = F[0]
     }
     return (source, githubName)
 }
 
-let lines = readLines("/tmp/swift_urls.tsv")
+let lines = readLines(filePath: "/tmp/swift_urls.tsv")
 var allUrls:[String:Int] = [:]
 
 var ok:Int

for line in lines {
    //    ok = false
    if !(line.hasPrefix("#") || line.hasPrefix(" ")) {
        let aLine = line.componentsSeparatedByString("\t")
        if aLine.count > 1 {

            if let groupNum = groupNumbers[aLine[0]] {
                let url = aLine[1]
                var (source, githubName) = deriveSource(url)
                // TODO: Check for trailing / and http vs https
                if let exists = allUrls[url] {
                    print("Error: Duplicate URL: \(url)")

            }
        }
    }
    
    writeGoVar(groupNum: row.groupNum, url:row.url, name:row.title, source:row.source, githubName: row.githubName, tags:row.tags,
               image:row.image, date:row.date,
               isPaywall:row.isPaywall,
               apisUsed: row.apisUsed,
               recType: row.recType,
               key: row.key)
}
print("}")

