Development Diary -20,190,612 keyword study notes, "Bird Brother Linux private kitchens - based learning articles"

Preface

Today efficiency really does feel pretty good = =, reading the two chapters to promote the progress of breath and a half, really, most feel now see things that are talking about how to use and write these in fact not very meaningful, and generally write after down I would not specifically to review the follow-up. So I decided, if that day is not particularly large follow-up sentiment, only this part of the content as a punch card-type record, I was, just today, I would have learned, to record a bit of nothing. For the "Bird Brother Linux private kitchens" This book, indeed, this is a book well worth reading the entry, the speakers also very easy to understand, thanks to him I was able to progress so quickly, but I still hope to substantial focus on the follow-up book, "Linux system Administration technical Manual", I have to get a job in the delicate balance between efficiency and speed. So, when I finished the Raiders a big chapter, I will carry out this section of the summary excerpt, in order to carry out a routine punch. Then read the next book, on the basis of this book I learned on, let absorb knowledge more fully. (After all, Linus personally recommend the book = =, still have to taste good taste)


Content

12.5 RECAP

  • The method is to deal with the regular expression string, which is processed in units of behavior to a string
  • Regular expressions assisted by some special symbols, allowing users to easily reach search, delete, replace handlers for a specific string
  • As long as the tool supports regular expressions, then the utility can be used as a regular expression string processing purposes
  • Regular expressions and wildcards style completely different. Wildcard (wildcard) represents a bash function of operation of the interface, but the regular expression is a character string showing a way of processing
  • When using grep or other tools to compare strings regular expression, because the encoding problems have different states, so you'd better set the LANG variables such as C or en English and other languages
  • grep and egrep regular expression which is very common in both programs, which, egrep support a more rigorous regular expression syntax
  • Due to different encoding systems, different languages ​​(the LANG) cause selected regular expression difference data can therefore be used as the special symbol [: upper:] instead of encoding the preferred range
  • Due to the different degrees of rigor, regular expressions on there are more stringent extended regular expression
  • Special characters are basic regular expressions * ,? , [], [-], [^], ^, $, etc.!
  • Common regular expression tools grep, sed, vim, etc.
  • printf may be used to format the data output via special symbols
  • awk can use the "field" as the basis, re-arrange and output data
  • Compare file, you can use diff and cmp comparison, which compares the old and new versions of diff primarily in terms of plain text files
  • patch command to update legacy data into the new (mainly created by the diff patch patch source file)

13.7 RECAP

  • shell script is a "program" the use of shell functions written (program), this program is a plain text file, some shell syntax and commands (including external command) written on the inside, with regular expressions, command and piping data traffic redirection and other functions, in order to achieve the treatment goal we want
  • shell script used in the management of the above system is an excellent tool, but used in a large number of numerical calculation process is not good enough, because the shell script slower, more CPU resources and use, resulting in poor allocation of host resources
  • In the shell script file, the command is from the top down, and left and right with the execution analysis
  • Shell script to perform at least need to have permission to r, if need direct command, you need to have the permission of r and x
  • In good programming habits, first row to declare shell (#! / Bin / bash), after the second line declares an application, version, author, etc.
  • On the type of script can be used to reach a read command
  • To create the data each time the script has executed different results may be achieved using the date command date
  • In terms of script execution time source to perform, on behalf of the father intended to perform within bash carried out!
  • If the judgment formula is required, or may be used in the test brackets ([]) treated
  • In the script, $ 0, 1.... 1.... @ Is of special significance
  • Conditional formula may be used to determine if ... then, if the case of a fixed variable content, use case $ var in ... esac treated
  • Cycle is divided into the indefinite loop (while, util) and a fixed cycle (for), with do, done to achieve the desired task
  • We can use the sh -x script.sh to debug the program

Daily Task

Eventually, you'll get old, and I will be crowned king!

Guess you like

Origin blog.csdn.net/qq_31433709/article/details/91645950
Recommended