Cut is a selection command, which is to analyze a piece of data and retrieve what we want. In general, the selection information is usually analyzed for "rows", not the entire information analysis. (1) The syntax format is: cut [-bn] [file] or cut [-c] [file] or cut [-df] [f
Alt-Backspace: cut the text from the cursor to the header. If the cursor starts with a word, cut the previous word
Cursor movement command
Ctrl-A: Move the cursor to the beginning of the line.
Ctrl-E: Move the cursor to the end of the row.
Ctrl-F: Move the cursor one character forward.
Ctrl-B: Move the cursor one character backward.
Alt-F: Move the cursor forward
Name: CutUse Rights: All usersUsage: cut-cnum1-num2 filenameDescription: Displays the text NUM1 to num2 from the beginning of each line.Example:shell>;>; Cat ExampleTest2This is Test1shell>;>; cut-c0-6 Example # # Print starts with the first 6 charactersTest2This ICut is actually useful.-C M-n represents the first m character of each line to the nth character. For example:---------file-----------Liubi 23 14
Tags: Linux boot process CD lsThe second wave of orders is coming to us: start-up process, PATH, filter level directory, CD parameters, LS-LRT, command cut logs1.1Linux boot- up process 1.1.1Post (Bios)--MBRBoot--GRUBMenu-- Load Kernel (Kernel)-- RunINITProcess-- Read/etc/inittabconfiguration file-- Execution/etc/rc.sysinitScripts (init scripts, such as settingsIP,hostname)-- Execution/ETC/RC.D/RC(software
Cut of linux byte truncation commandExecution permission: All UsersLocation:/usr/bin/cutSyntax: cut options... file...
Function: character truncation command, which uses TAB as the default delimiter
Limitation: when space is used as the separator, the cut command cannot be
a delimiter to sort the 2nd field[email protected] test]# Cat Sort.txt | Sort-t ":"-K 2D:1F:11C:2B:3A:4E:5Use ":" To make a delimiter, sort the 2nd field, sort by number size[email protected] test]# Cat Sort.txt | Sort-t ":"-K 2-nD:1C:2B:3A:4E:5F:11Sort the/etc/passwd files by uid[Loring test]# Sort-t ":"-K 3-n/etc/passwdSort the passwd files in the order of the UID from large to small[Loring test]# Sort-t ":"-K 3-nr/etc/passwdPrint/etc/group in order of GID from small to large[Loring test]# so
Getting started with Linux shell scripts--cut commandCutThe Cut command extracts text columns from a text file or text stream.Cut grammar[[email protected] ~]# Cut- D " Delimited character " -F fields for having a specific delimiter character [[ Emailprotected] ~] # cut
in order. -Fwhen sorting, ignores uppercase and lowercase letters. -Mthe front3the letters are sorted according to the abbreviation of the month. -Nsorts according to the size of the numbers. -oOutput File>The sorted result is stored in the specified file. -Rsorted in reverse order. -tDelimited characters>Specifies the field separator character to use when sorting. -KChoose which interval to sort by. Example: [email protected] ~]# sort 1abc.txtAbcdAbcdAbcdAbcddAbcddAcbdCcceDefEfgEfgEfggGhiHijkH
Cut action and usage:Cut [-option] file nameCut-remove sections from all line of filesCut a piece of content from each line of a file-D: Specify the field delimiter, the default delimiter is a space-F: Specify the fields to display-f1,3 showing 1 and 3 segments-f1-3 Show from 1 to 3 segments, i.e.[Email protected] test]# cut-d:-f1,3/etc/passwdroot:0Bin:1Daemon:2Adm:3Lp:4Sync:5Shutdown:6[Email protected] tes
Tags: Linux inet6 4.0 linu logs scope EFI bytes MAC addressInput:ifconfig eth0The eth0 represents the first NIC of the host.Output:eth0:flags=4163 theinet192.168.118.136Netmask255.255.255.0Broadcast192.168.118.255Inet6 fe80::20c:29ff:fe2c:3c8f Prefixlen -ScopeID0x20etherxx: 0c: in: 2c:3c:8f Txqueuelen +(Ethernet) RX packets153785bytes172057146(164.0MiB) RX Errors0Dropped0Overruns0Frame0TX Packets67213bytes9694191(9.2MiB) TX Errors0Dropped0Overruns0Carrier0Collisions0Rx for the received packet, T
used with 01, instead of a newline character, it is split with-L number does not cut with a cut, but is called with the data of this number row after every number row is read utility-N number is cut and the results are grouped by each number, using each set of results as parameters, calling utility-X finds that if the number of parameters is insufficient, termin
Execute permissions: All UsersLocation:/usr/bin/cutSyntax: Cut options ... file ...Function: Character intercept command, tab (tab) as default delimiterLimitation: When a space is used as a delimiter, the cut command cannot be extractedOptions-F Columncut-f 2 Test.txt Extract second column (tab as default delimiter)
Shell Special Symbol Cut commandShell Special Symbols* *任意个任意字符* ?任意一个字符* #注释字符* \脱义字符* |管道符Command cutcut is used to intercept a field in the form of: #cut –d ' separator character ' [-cf]n,n is a number.Options:- D is followed by a delimiter, and delimited characters are enclosed in single quotes.- c is followed by the number of characters.The number of blocks
[Email protected] desktop]# cat> fruits.txtbananaorangepersimmonpercentbananaappleoragecat> fruits.txtPress CTRL D to end Fruits.txt input[email protected] desktop]# cat Fruits.txtbananaorangepersimmonpercentbananaappleorageCat Fruits.txtShows an application of the sort command. We set Lang=en_us to sort them, and the rules for sorting are ASCII. ASCII sequence,% before uppercase, if your current environment is made outside of ASCIICharacter set, the
sorting, and the number of occurrences of the row is output at the beginning of the line#sort Testfile | UNIQ-C1 Friend3 Hello2 WorldDisplays only duplicate rows, and displays the number of repetitions of the row at the beginning of the line#sort Testfile | UNIQ-DC3 Hello2 WorldShow only rows that are not duplicatesSort Testfile | Uniq-ufriend CutThe Cut command extracts text columns from a text file or t
Centosvi copy and delete the cut paste command
Copy:
Yy: copy the current row
Nyy: Number of copied rows (including the current row ). Assume that three rows are copied, And the cursor is positioned at the position of Row 3. If you enter 3yy, 1 ~ is copied ~ 3 rows of content
Copy multiple rows in another way: (start row, end row co paste position), for example, copy 3 ~ Paste the content of five lines
Centos vi copy and delete the cut paste command, centos Paste
Copy:
Yy: copy the current row
Nyy: Number of copied rows (including the current row ). Assume that three rows are copied, And the cursor is positioned at the position of Row 3. If you enter 3yy, 1 ~ is copied ~ 3 rows of content
Copy multiple rows in another way: (start row, end row co paste position), for example, copy 3 ~ Paste the content
1 basic data unit for Cut command processingAs with most text processing tools, cut is also based on the behavior of the basic data unit.2 use of the Cut commandGu Mings, cut is to cut out the rows to meet the conditions of the da
Sometimes we often encounter such a problem: there is a page of the telephone number is thin, in order to write the rules of people's names, home addresses, telephone, notes, etc., at this time we just want to get everyone's name and their corresponding phone number, you have several ways to achieve it?
It is true that this vertical positioning is difficult to achieve by conventional means, at which point cut will be able to work.
What ' s
Cut large files by line (linux split command Lite version), linuxsplitCutting large files by line (linux split command Lite version)
#-*-Coding: UTF-8-*-_ author _ = 'knowlifedeath ''' the Split command on Linux allows you to easily Split large files, this PY script is used to cut
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.