LoginSignup
0
0

More than 1 year has passed since last update.

teip

コマンドインストール方法

$ wget https://github.com/greymd/teip/releases/download/v2.0.0/teip-2.0.0.x86_64-unknown-linux-musl.deb
$ sudo dpkg -i ./teip*.deb

使い方

  • 基本動作
    fオプションで区切られたフィールドを選択する。

    $ echo "100 200 300 400" | teip -f 3
    100 200 [300] 400
    
  • コマンド利用
    フィールド選択後コマンドを記述する。
    (コマンドの前に--記述推奨)

    $ echo "100 200 300 400" | teip -f 3 -- cut -c 1
    100 200 3 400
    
  • 範囲指定

    fオプションで選択対象を指定できる。
    ※teip -f -3の時にエラーが起きました。
     公式の入力例と異なる挙動です。

    $ echo "100 200 300 400" | teip -f 1-3 -- sed 's/./@/g'
    @@@ @@@ @@@ 400
    $ echo "100 200 300 400" | teip -f 2- -- sed 's/./@/g'
    100 @@@ @@@ @@@
    
    
  • 文字範囲選択

    $ echo ABCDEFG | teip -c 1,3,5,7 -- sed 's/./@/'
    @B@D@F@
    
  • 区切りテキストの処理(CSV、TSV等)
    dオプションを使用する。

    • CSV処理
      $ echo "100,200,300,400" | teip -f 3 -d , -- sed 's/./@/g'
      100,200,@@@,400
      
    • TSV処理
      $ printf "100\t200\t300\t400\n" | teip -f 3 -d $'\t' -- sed 's/./@/g'
      100     200     @@@     400
      
    • 拡張正規表現指定
      Dオプションを使用する。
      $ echo "1970-01-02 03:04:05" | teip -f 2-5 -D '[-: ]' -- sed 's/./@/g'
      1970-@@-@@ @@:@@:05
      

参考文献

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0