0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[Linux] テキスト処理_コマンド_cat, nl, od, head, tail, cut, paste, tr, sort, split, uniq, wc, xargs,

Last updated at Posted at 2025-02-02

catコマンド

$ cat [ファイル名]
オプション 由来 説明
デフォルト
concatenate(連結する)
- ファイルの内容を標準出力に表示する
-n - 各行の左端に行番号を追加する

nlコマンド

$ nl [オプション] [ファイル名]
オプション 由来 説明
デフォルト - テキストファイルの一部または全部に行番号をつけて表示する
-b 形式 body(全文) - 形式で全文に行番号をつける
-h 形式 header - 形式でheaderに行番号をつける
-f 形式 footer - 形式でfooterに行番号をつける

trコマンド

$ tr [オプション] [文字列1 [文字列2]]
オプション 由来 説明
デフォルト - 標準入力から読み込まれた文字列を変換・削除する
-d delete - [文字列1]でマッチした文字列を削除する
-s squeeze(絞る) - 連続するパターン文字列を1つに絞る

sortコマンド

$ sort [オプション] [ファイル名]
オプション 由来 説明
デフォルト - 行単位でファイルの内容をソートする
- 昇順でソートする
-b ignore leading blanks - 先頭の空白を無視して比較する
-d dictionary order - 英数字と空白のみを考慮して比較する
-f fold case - 大文字小文字を区別せずに比較する
-g general numeric sort - 数値として比較(指数表記も対応)
-i ignore non-printing - 印刷できない文字を無視
-M month sort - 月名(Jan, Feb, ...)でソート
-n numeric sort - 数値として比較(整数のみ)
-r reverse - 降順(逆順)にソート
-k key - 指定したフィールド(列)でソート
-t field separator - フィールド(列)の区切り文字を指定
-u unique - 重複行を削除
-V version sort - バージョン番号順にソート
-o output file - 結果を指定したファイルに保存
-c check - ソートされているか確認
--help help - 使用方法を表示
--version version - バージョン情報を表示

splitコマンド|オプション

オプション 由来 説明
デフォルト - 行単位でファイルを分割する
- 1000行で分割する

Ping-t

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?