• Summarize the use of awk, SED, grep commands for text processing in Linux


    awkBasic conceptsAwk regards the file (or other input streams, such as redirected input) as a recordset, each line as a record, and the string separated by a space (or a separator specified by the user) in each line as a field. This seems to regard the file record as a database. However, Awk is still […]

  • Detailed explanation of the usage of SED and awk in Linux


    Sed usage: Sed is a very good file processing tool. It is a pipeline command. It is mainly processed in behavioral units. You can replace, delete, add, select data lines and other specific work. Let’s learn about the use of SED first The SED command line format is: Sed [- nefri] ‘command’ enter text Common […]

  • Introduction to Linux basic commands 10: text stream editing sed


    AndvimDifferent,sedIt is a non interactive text editor. At the same time, it is character flow oriented. Each line of data passes throughsedOutput after processing. sed [OPTION]… [script] [file]… sedFirst, initialize two data buffersMode spaceandKeep space;sedRead a line of input (from a standard input or file), remove the line break (\ n) at the end and […]

  • Linux sed command interchanges lines with specified keywords


    A. the contents of TXT are as follows: 111 222 baidu 333 444 google 555 666 Exchange the lines containing Baidu and Google to get: 111 222 google 333 444 baidu 555 666 Code 1: sed ‘/baidu/{:a;N;/google/!ba;s/\([^\n]*\)\n\(.*\)\n\(.*\)/\3\n\2\n\1/}’ a.txt Code 1 execution: Code 2: sed ‘/baidu/{:a;N;/google/{s/\(^[^\n]*\)\(.*\)\(\n\)\([^\n]*$\)/\4\2\3\1/;t};ba}’ a.txt Code 2 execution: Features of code 1 and code […]

  • The Method of Using GNU sed on Linux


    The Linux Foundation announced a new LFCS (Linux Foundation Certified Sysadmin) certification program. This program aims to help people all over the world gain certification of their ability to handle Linux system management tasks. These capabilities include system services to support operations, as well as first-hand fault diagnosis, analysis, and informed decision-making for the engineer […]

  • Sed Command in Linux


    sedIt is a stream editor. It is a very useful tool in text processing. It can perfectly match regular expressions, and its functions are outstanding. When processing, the currently processed rows are stored in a temporary buffer, called pattern space, and then the contents of the buffer are processed with sed command. After processing, the […]

  • The most commonly used set of “Sed” techniques in Linux production environments


    sedCommands are widely used and easy to use. They are powerful tools for fast text processing. In fact, it does not have many skills, recitation, use is the most appropriate learning channel, belongs to the hard skills. But it’s complicated because there are too many advanced functions. This article does not focus on the advanced […]

  • Learn SED in 30 minutes


    This article takes the 30 minutes to learn AWK. After learning AWK, I took advantage of the hot iron to learn SED. I have to say that these two tools are really text processing artifacts. Who knows how to use them? Most of the content of this article is still an introductory course translated from […]

  • Regular expressions, grep, sed, awk for shell scripts


    –Regular– Basic Rules ^ Word # Searches for the beginning of the line ^ in vi/vim that begins with wordWord $. # Searches for the end of the $line in vi/vim ending with word^ ($) # indicates empty lines.The Represents and can only represent any character\## Example: \ Represents only the point itself, escapes the […]

  • Detailed summary of Linux sed multiline processing


    Normally, sed reads the lines to be processed into the schema space, and the commands in the script process the lines one by one until the script is executed, then the line is output, and the schema space is empty; then repeat the previous action, and the new line in the file is read in […]