Java Grep Library

前端 未结 4 2239
南笙
南笙 2020-12-05 23:43

Is there any good, simple Java Grep Library? I\'m not opposed to native code, or scripting, and I\'ll do it, but for my purposes, throughput is not a huge deal, and it would

4条回答
  •  孤城傲影
    2020-12-06 00:41

    Unix4j also implements a (pure java) grep command: http://www.unix4j.org

    Unix4j.fromStrings("1:A", "2:B", "3:AB", "4:AC", "5:ABC").toFile("myFile.txt");
    Unix4j.fromFile("myFile.txt").grep("AB").toStdOut();
    
    >>>
    3:AB 
    5:ABC
    

    Disclaimer: I am one of the contributors to the unix4j project.

提交回复
热议问题