V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
爱意满满的作品展示区。
odokei

是我孤陋寡闻还是真的没有一个 [文本文件随机抽样工具] ,反正我自己写了一个(Rust 真香),欢迎使用。

  •  
  •   odokei · Apr 28, 2024 · 1967 views
    This topic created in 733 days ago, the information mentioned may be changed or developed.

    介绍

    文本文件抽样工具,超方便的日志文件抽样。

    地址 https://github.com/zhangtaomox/samples

    samples -k 2 -f Cargo.toml
    # output
    version = "1.0.5"
    keywords = ["sample", "rand", "cli"]
    

    详细使用方式 https://github.com/zhangtaomox/samples

    3 replies    2024-05-01 02:10:15 +08:00
    sagaxu
        1
    sagaxu  
       Apr 28, 2024 via Android
    shuf 和 rl 都可以啊
    odokei
        2
    odokei  
    OP
       Apr 28, 2024
    @sagaxu 受教
    zsh2517
        3
    zsh2517  
       May 1, 2024
    #1 提到的 shuf 大概这样(很多操作命令行都有能用的,比如排序、计数、简单文本处理等,一般搞个 alias 就够了)

    ```
    ◉ /tmp > cat 1.txt
    1
    2
    3
    4
    5
    ◉ /tmp > cat 1.txt | shuf | head -n 3 (或者 shuf 1.txt | head -n 3 )
    4
    1
    3
    ```
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2514 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 15:30 · PVG 23:30 · LAX 08:30 · JFK 11:30
    ♥ Do have faith in what you're doing.