LoginSignup
14
15

More than 5 years have passed since last update.

ファイルを任意サイズで切り出す

Last updated at Posted at 2014-10-03

バイト数指定すると割と早く処理できる。
バイト数は、less で検索して=で表示される結果で調べてる。
tailで+指定は推奨されないとか書いてあるけど便利。

先頭から指定したSバイト数だけ切り出す

普通の使い方だこれ。-nで行数指定の方が簡単。

$ head -c S ファイル名 > 切り出し先ファイル名

先頭から指定したSバイト目以降を切り出す

$ tail -c +S ファイル名 > 切り出し先ファイル名

先頭からSバイト目以降、Nバイトを切り出す

$ tail -c +S ファイル名 | head -c N > 切り出し先ファイル名

参考

tail - cat line X to line Y on a huge file - Unix & Linux Stack Exchange

14
15
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
14
15