Under Linux system, some txt files are relatively large, and it is very inconvenient to transfer to mobile devices. Can you turn txt files into multiple small files? In fact, it can be achieved through shell scripts. The following small series will introduce you to the method of cutting txt large files through shell scripts.
Solution:
1. first use the split command to cut large files, each small file saved one million lines
split parameters:
-b : You can select the size of the file to be divided into later, you can add units, such as b, k, m, etc.;
-l : divide by the number of lines;
#按Split 1000 lines per file except
split -l 1000 httperr8007.log httperr
httpaa,httpab,httpac. . . . . . . .
# Split by 100K per file
split -b 100k httperr8007.log http
httpaa,httpab,httpac. . . . . . . .
2. Traverse all 1 million lines of files, create new one by one and cut into 10,000 lines of small files
#! /bin/bash
bigfile=“1.txt”
split -l 1000000 $bigfile text
currdir=1
for smallfile in ` Ls
In the Gnome graphical desktop environment of Ubuntu system, some users have encoun
We all know how to delete system files under Linux, but sometimes it is not complete, how to complet
Linux cp command usage is mainly used to copy files, plus parameters can also copy the directory, th
Linux is the most horrible problem with git bash. Once garbled, it will affect git
How to use the showmount command in Linux systems
How to use commands to manage files in Linux
Knowledge about file I/O operations under Linux
How to install boost library in Linux system
How to use the df command to view Linux disk space?
How to modify the app icon icon under Ubuntu Gnome
Summary of tar commands in Linux system
How to disable the silent request of Firefox under Linux
Ubuntu 14.04 install java method
File recovery after diskgenius accidentally deleted or misformatted
Windows10 system laptop brightness can not be adjusted how to solve
How to uninstall PHPnow in WinXP? Completely uninstall PHPnow method
How does Win10 rotate the display? Three settings for win10 screen flip
Win7/Win8.1 users upgrade Win10 This notification is to upgrade Win10 Pass
How to automatically play and replace the favorite wallpaper
Recover corrupted XP system files