Jump to content

split (Unix)

This is a fully translated article. Click here for more information.
From DawoumWiki, the free Mathematics self-learning

split
Original author(s)AT&T Bell Laboratories
Developer(s)Various open-source and commercial developers
Initial releaseFebruary 1973; 51 years ago (1973-02)
Operating systemUnix, Unix-like, Plan 9, IBM i
PlatformCross-platform
TypeCommand
Licensecoreutils: GPLv3+

split은 컴퓨터 파일을 둘 이상의 작은 파일로 분할하기 위해 가장 일반적으로 사용되는 유닉스, Plan 9, 및 유닉스-계열 운영 시스템의 유틸리티입니다.

History

split 명령버전 3 유닉스에 처음 등장했었고[1] 1987년 2호부터 X/Open 이식성 안내서의 일부입니다. 그것은 POSIX.1의 첫 번째 버전과 단일 유닉스 사양으로 상속되었습니다.[2] GNU coreutils에 번들로 제공되는 split 버전은 Torbjorn Granlund와 Richard Stallman에 의해 작성되었습니다.[3] split 명령은 IBM i 운영 시스템에도 이식되었습니다.[4]

Usage

명령-구문은 다음과 같습니다:

 split [OPTION] [INPUT [PREFIX]]

split의 기본 동작은 고정된 크기, 기본 1000 줄의 출력 파일을 생성하는 것입니다. 파일은 output filenameaa, ab, ac, 등을 덧붙임으로써 이름-지어집니다. 만약 output filename이 주어지지 않으면, x의 기본 파일이름이 사용됩니다, 예를 들어, xaa, xab 등. 하이픈 (-)이 input filename 대신 사용되면, 데이터는 표준 입력에서 파생됩니다. 파일은 전형적으로 cat과 같은 유틸리티를 사용하여 다시 결합됩니다.

추가적인 프로그램 옵션은 최대 문자 카운트 (줄 카운트 대신), 최대 줄 길이, 생성된 파일이름에서 증가하는 문자 숫자, 및 문자 또는 자릿수를 사용할지 여부를 허용합니다.

Split file into pieces

정확히 3,000줄의 데이터를 갖는 "myfile.txt"라는 파일을 생성합니다:

$ head -3000 < /dev/urandom > myfile.txt

이제, split 명령을 이 파일을 조각으로 나누기 위해 사용하십시오 (참고: 달리 지정되지 않은 한, split은 파일을 1,000-줄 파일들로 나눌 것입니다):

$ split myfile.txt
$ ls -l
-rw-r--r--  1 root root 761K Jun 16 18:17 myfile.txt
-rw-r--r--  1 root root 242K Jun 16 18:17 xaa
-rw-r--r--  1 root root 263K Jun 16 18:17 xab
-rw-r--r--  1 root root 256K Jun 16 18:17 xac
$ wc --lines xa*
  1000 xaa
  1000 xab
  1000 xac
  3000 total

위에서 보았듯이, split 명령은 원본 파일 (원본은 그대로 유지)을 줄의 숫자 (즉, 1,000)과 같은 세 개의 파일: xaa, xab, 및 xac로 나눕니다.

See also

References

  1. ^ split(1) – FreeBSD General Commands Manual
  2. ^ split – Commands & Utilities Reference, The Single UNIX Specification, Issue 7 from The Open Group
  3. ^ "split(1): split file into pieces - Linux man page". linux.die.net.
  4. ^ IBM. "IBM System i Version 7.2 Programming Qshell" (PDF). Retrieved 2020-09-05.{{cite web}}: CS1 maint: url-status (link)

External links