Search Results

Search found 2 results on 1 pages for 'bjornar kibsgaard'.

Page 1/1 | 1 

  • Read line and change the line that not consist of certain words and not end with dot

    - by igo
    I wanna read some text files in a folder line by line. for example of 1 txt : Fast and Effective Text Mining Using Linear-time Document Clustering Bjornar Larsen WORD2 Chinatsu Aone SRA International AK, Inc. 4300 Fair Lakes Cow-l Fairfax, VA 22033 {bjornar-larsen, WORD1 I wanna remove line that does not contain of words = word, word2, word3, and does not end with dot . so. from the example, the result will be : Bjornar Larsen WORD2 Chinatsu Aone SRA International, Inc. {bjornar-larsen, WORD1 I am confused, hw to remove the line? it that possible? or can we replace them with a space? here's the code : $url = glob($savePath.'*.txt'); foreach ($url as $file => $files) { $handle = fopen($files, "r") or die ('can not open file'); $ori_content= file_get_contents($files); foreach(preg_split("/((\r?\n)|(\r\n?))/", $ori_content) as $buffer){ $pos1 = stripos($buffer, $word1); $pos2 = stripos($buffer, $word2); $pos3 = stripos($buffer, $word3); $last = $str[strlen($buffer)-1];//read the las character if (true !== $pos1 OR true !== $pos2 OR true !==$pos3 && $last != '.'){ //how to remove } } } please help me, thank you so much :)

    Read the article

  • Ubuntu Server 12.04, NAT, Router, DNS. It just doesnt work

    - by Bjørnar Kibsgaard
    I recently inherited some server hardware from work and decided that it could be my main router at home (among other things). Ubuntu 12.04 server installation harware wise goes well and everything is found and working when I boot up. So I begin with setting up eth1 with DHCP. This works fine and it gets a public IP address from my modem and we have a working internet connection. Then I set up my other NIC (eth0) as static (192.168.0.1) and this also works fine. I can access it from other computers in the network. The problems are coming when I am trying to set up a DHCP server with isc-dhcp-server. It seems like it is working and giving the computers IP adresses but after one reboot it stops working. After the reboot eth1 will get a public ip from the modem but it doesnt have internet access. I have to manually run dhcpcd eth1 to get it to work again. As far as I know I havent made any changes to DNS. What am I doing wrong? I have never really had problems with this before. :)

    Read the article

1