In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to achieve file segmentation and merging under Linux, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
File segmentation under linux can be achieved through the split command, you can split a large file into multiple files of a specified size, and the split speed is very fast, you can specify two modes: split by the number of lines and Ann size. File merging under Linux can be achieved through the cat command, which is very simple.
File Segmentation with split under Linux
Take a look at the help documentation first.
Usage: split [OPTION]... [INPUT [PREFIX]] Output fixed-size pieces of INPUT to PREFIXaa, PREFIXab,...; defaultsize is 1000 lines, and default PREFIX is `xrabbit. With no INPUT, or when INPUTis -, read standard input.Mandatory arguments to long options are mandatory for short options too. -a,-- suffix-length=N use suffixes of length N (default 2) specify the suffix length of the split file-b,-- bytes=SIZE put SIZE bytes per output file split by byte, default unit byte-C,-- line-bytes=SIZE put at most SIZE bytes of lines per output file specify the maximum size of a single line The default unit byte is-d,-- numeric-suffixes use numeric suffixes instead of alphabetic uses a number as the suffix-l for split files,-- lines=NUMBER put NUMBER lines per output file splits by number of lines-- verbose print a diagnostic just before each output file is opened-- help display this help and exit-- version output version information and exit
Mode 1: specify the number of file lines after split
For txt text files, you can split the file by specifying the number of lines of the split file.
Command:
Split-l 300 large_file.txt new_file_prefix
Default generation after sharding with suffixes aa, ab, ac... And so on, of course, you can also customize the suffix.
Mode 2: specify the split file size
Split-b 10m server.log waynelog
We can also separate binaries by file size.
File merging with cat under Linux
Command:
Cat small_files* > large_file Thank you for reading this article carefully. I hope the article "how to split and merge documents under Linux" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.