split

박태영·2024년 4월 2일
0

split

  • 파일을 나누는 명령어
split k 
-rw-r--r--  1 nayuta  staff   662K  4  2 15:09 k
-rw-r--r--  1 nayuta  staff   662K  4  2 15:13 k2
-rw-r--r--  1 nayuta  staff    51K  4  2 15:35 xaa
-rw-r--r--  1 nayuta  staff    45K  4  2 15:35 xab
-rw-r--r--  1 nayuta  staff    48K  4  2 15:35 xac
-rw-r--r--  1 nayuta  staff    52K  4  2 15:35 xad
-rw-r--r--  1 nayuta  staff    46K  4  2 15:35 xae
-rw-r--r--  1 nayuta  staff    44K  4  2 15:35 xaf
-rw-r--r--  1 nayuta  staff    39K  4  2 15:35 xag
-rw-r--r--  1 nayuta  staff    46K  4  2 15:35 xah
-rw-r--r--  1 nayuta  staff    49K  4  2 15:35 xai
-rw-r--r--  1 nayuta  staff    54K  4  2 15:35 xaj
-rw-r--r--  1 nayuta  staff    49K  4  2 15:35 xak
-rw-r--r--  1 nayuta  staff    48K  4  2 15:35 xal
-rw-r--r--  1 nayuta  staff    49K  4  2 15:35 xam
-rw-r--r--  1 nayuta  staff    44K  4  2 15:35 xan
  • 기본은 라인 단위(1000줄) 로 나뉘게 된다

  • -d 옵션을 주면 영어가 아니라 숫자이름으로 파일이 나뉘게 된다

  • -d 옵션 뒤에 -a 옵션을 붙이면 몇자리의 숫자로 나눌것인지 설정 할 수 있다

-rw-r--r--  1 nayuta  staff   662K  4  2 15:09 k
-rw-r--r--  1 nayuta  staff   662K  4  2 15:13 k2
-rw-r--r--  1 nayuta  staff    51K  4  2 15:37 x0000
-rw-r--r--  1 nayuta  staff    45K  4  2 15:37 x0001
-rw-r--r--  1 nayuta  staff    48K  4  2 15:37 x0002
-rw-r--r--  1 nayuta  staff    52K  4  2 15:37 x0003
-rw-r--r--  1 nayuta  staff    46K  4  2 15:37 x0004
-rw-r--r--  1 nayuta  staff    44K  4  2 15:37 x0005
-rw-r--r--  1 nayuta  staff    39K  4  2 15:37 x0006
-rw-r--r--  1 nayuta  staff    46K  4  2 15:37 x0007

...
...
  • 파일 이름 뒤에 문자를 입력하면 해당 문자가 접두사로 파일명 앞에 붙게 된다
split -d -a4 k prefix_
-rw-r--r--  1 nayuta  staff    51K  4  2 15:38 prefix_0000
-rw-r--r--  1 nayuta  staff    45K  4  2 15:38 prefix_0001
-rw-r--r--  1 nayuta  staff    48K  4  2 15:38 prefix_0002
-rw-r--r--  1 nayuta  staff    52K  4  2 15:38 prefix_0003
-rw-r--r--  1 nayuta  staff    46K  4  2 15:38 prefix_0004
-rw-r--r--  1 nayuta  staff    44K  4  2 15:38 prefix_0005
-rw-r--r--  1 nayuta  staff    39K  4  2 15:38 prefix_0006
-rw-r--r--  1 nayuta  staff    46K  4  2 15:38 prefix_0007

...
...
  • -l 옵션 뒤에 숫자를 입력하면 숫자만큼 줄로 나누어 파일을 저장한다
split -d -a4 -l2000 k
  • -b옵션을 주게 되면 용량 단위로 파일을 나누게 된다(
    - 숫자 뒤에 단위를 설정 가능하다(k(K):킬로바이트,m(M):메가바이트,g(G):기가바이트)
split -d -b30m k (30 메가바이트 단위로 파일을 나눔)
  • -n 옵션을 주게 되면 파일 갯수로 나누게 된다
split -n5 k backup_ (5개 파일로 나눔)
-rw-r--r--  1 nayuta  staff   132K  4  2 15:53 backup_aa
-rw-r--r--  1 nayuta  staff   132K  4  2 15:53 backup_ab
-rw-r--r--  1 nayuta  staff   132K  4  2 15:53 backup_ac
-rw-r--r--  1 nayuta  staff   132K  4  2 15:53 backup_ad
-rw-r--r--  1 nayuta  staff   132K  4  2 15:53 backup_ae
profile
어른 아이

0개의 댓글