Tags: Shell special symbol cut, sort, WC, uniq, tee, TR, split command* Represents 0 or more arbitrary characters[[email protected] ~]# ls *txt11.txt 1.txt 22.txt 2.txt aa.txt a.txt? Represents only one arbitrary characterWhether it's a number or a letter, as long as it matches a single character.[email protected] ~]# ls?. Txt1.txt 2.txt a.txt B.txt[[email protected] ~]# ls? txtls: unreachable? txt: no file or directoryComment Symbol #, after which th
Linux tee command-specific application of the tee command: tee Function Description: Read standard input data and output its content into a file. Syntax: tee [-ai] [-- help] [-- version] [file…] Note: The tee command reads data from the standard input device, outputs the dat
In Linux, the system that improves performance calls sendfile. Splice and tee may be familiar with Linux kernel version 2.4: a static Web Page Server named khttpd is embedded in the kernel of version 2.4. At that time, it may be because of the efficiency factor that she was added. As to why the latest version 2.6 kernel removed this server, I think it may be because the Linux kernel "only provides a mechanism, and does not provide a policy ", of cours
1. under the root directory/core: This directory file is only used to build tee core/lib: This directory file is used to build tee core and trusted applications/ta: This directory file is only used to build trusted applications/MK: Build the system's compiled file (Makefile)/tmp-stuff: Temporarily stored and will be deleted before final compilation is complete/scripts: Help scripts for multiple tasks/out: I
Cut to segment a fileCut-d: (Specifies the delimiter)-f (paragraph) 3,4,5/etc/passwdCUT-C (intercept the first few characters) 1-10/etc/passwdSort used for sortingSORT-T: (Specifies the delimiter)-K3 (paragraph)-N (Pure numeric sort)/etc/passwdSORT-T: (Specify delimiter)-k3,5 (interval segment with, number, not used-)-N (Pure numeric sort)-R (reverse order)-U (de-duplication)/etc/passwdWc-l (number of lines in a document) 1.txt 2.txtWc-w (How many word words) 1.txtWc-m (number of characters, inc
Shell Basics (iv) Uniq and TeeUniq is used to repeat the row, the most common option is only one, that is,-C count counts the number of repeated rows, and writes the number of repetitions in front.Note: Use the premise that you need to sort the files first, otherwise it won't work.#vim aming.txt "Write"111222111333#uniq aming.txt "Separate use of uniq, do not remove duplicate lines that are not together."111222111333#sort aming.txt |uniq "After using sort, use Uniq"111222333#sort Aming.txt |uniq
-I ignores caseBut then there will be no output generated, because when the two files are the same as the default behavior, if you want to see the prompt say the same thing:-S option reports the same two filesUse -B to ignore spacesCompare two files differently and produce patchesIn addition to files, thediff command can compare two directoriesVimdiffThere is only one row in a file, the color is relativeTwo files exist, but contain differences in the behavior of one color, causing the difference
removes the wtmp row, you can understand the number of rows to be calculated.
Bidirectional redirection: Tee
[Root @ Linux ~] # Tee [-A] FileParameters:-A: add data to the file in the append mode!Example:[Root @ Linux ~] # Last | tee last. List | cut-d ""-F1# This example allows us to save the last output to the last. list file;[Root @ Linux ~] # Ls-L/home |
Linux I/O redirection and pipelines (about tr and tee commands)
When I first started to get in touch with IO redirection, I had gone through the process of understanding, understanding, and then rolling. Of course, now I cannot fully understand IO redirection, I am not confused about IO redirection when solving some problems or implementing some results.
What is IO redirection?
To solve this problem, we need to first understand what is IO and what is
To think of something simple, we know that > will transfer the data stream to a file or device, so we cannot continue to use this stream unless we go to read the file or device. What should I do if I want to save a piece of information in the process of processing this data stream? With tee We can look at this in a simple way:Tee will distribute the data stream to the file and screen at the same time, and the output to the screen is actually stdout, a
; Data_bck.sqlDelete all previous incremental logs and generate new logs after fully backing up all databases:MYSQLDUMP-H192.168.4.20-UUSERNAME-PUSERPSWD--single-transaction--flush-logs--master-data=2--all-databases-- Delete-master-logs>data_bck.sqlIncremental backups:Perform a full backup first, and then perform the update log:MYSQLADMIN-H192.168.4.20-UUSERNAME-PUSERPSWD Flush-logs
Third: Directly copy the Data directory.Stop the MySQL service or lock the database table, copy the data director
Usage of tee: tee [Option]... [file]... copy the standard input to each specified file and display it to the standard output grep-r-I-E "sss | aaa ". /| grep-v. /doc/| tee-a log.txt grep-E is matched by regular expression www.2cto.com grep-r is a recursive directory grep-v is excluded from some subdirectories. The tee-
used to repeat the line, the most common option is only one-C: Statistics duplicate rows, and write the number of lines in front */[[email protected] ~]# VIM test.c//use VIM to open a file, write several numbers 111222333222444333~[[email protected] ~]# uniq test.c//Direct with UNiq command, found that the file did not change 111222333222444333[[email protected] ~]# sort test.c |uniq//First sort, then in Uniq, so use Uniq if you have to sort the files and then repeat111222333444[[email protecte
Function Description: Reads the standard input data and outputs its contents to a file.Syntax: Tee [-ai][--help][--version][file ...]Note: The tee instruction reads data from a standard input device and outputs its contents to a standard output device while saving it as a file.Parameters-A or--append attaches to the back of the existing file rather than overwriting it.The interrupt signal is ignored by the-
and shell of the 9th user in the/etc/passwd file.Display to the screen and save it to the/tmp/users file;[Email protected] ~]# tail-9/etc/passwd | head-1 | Cut-d:-f1,7|tee/tmp/usersRpcuser:/sbin/nologin Tee content is displayed on the screen and saved to the specified directory7. Display all files starting with PA in/etc directory, and count the number of them; [Email protected] ~]# ls-d/etc/pa* | Wc-l48,
About the Tee command is the delivery of standard input information to a file.Use the Linux Help documentation as follows:Tee: Read from standard input and write to standard output and filesCommand form: Tee [options] FileOptions:-A--appendAppend to end of file, do not overwrite file-I.--ignore-interruptsIgnore interruptsAn example to output the row redirection of a root-containing item in the current direc
#去重复, one more feature than sortUniq 2.txt adjacent two digits to repeat#显示重复的次数Uniq-c 2.txt#与sort一起用Sort 2.txt | Uniq-c#写入并显示出来echo "111111" | Tee 1.txtExercises:1. Uniq is used to repeat, what command do we need to use before we can repeat the process?Sort2. Uniq which option can show the number of repetitions?-C3. What is the role of the tree command?Directs the correct output information to a file and displays it on the current screenSummarize:Mai
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.