Summary of Shell interception string methods in Linux

Reference documents:There are eight ways to intercept a string, mainly for the following methods650) this.width=650; "alt=" Copy Code "src=" Http://common.cnblogs.com/images/copycode.gif "/>There are a number of ways to intercept strings in the

Conditional expressions in the shell

The result returned by the conditional expression is BooleanIt's 1, false is 0.Expressions for conditional tests[Expression][[Expression]]Test expressionCommonly used for:Monocular:-e file Test files exist-F file Test is a normal file-D File Test

Shell script Try it a little bit

package.sh #!/bin/bashfor i in ' cat $ ' do echo $i >> resultdpkg-l | grep $i | Sed-n 1p > Tmp//awk read out all the data after the fifth column awk ' {for (i=5;i> result//the error content of the script Directed to a file in sudo dpkg--purge $i >>

GitHub's use (Git Shell)

I am not clever and understanding something are not quick. Even so,i can ' t be scared for facing it. Practice more and practice more. Don ' t stop your passion. Recently to work on GitHub with small partners to do projects, my github ....

Call the shell script in Qt and monitor the returned method

In Qt, you often invoke external commands or execute shell scripts, and you want to analyze the execution results.Qprocess runshellprocess =new qprocess (this); // Monitoring of invoking process outputs This , SLOT (Readprocess ())); Connect (

Shell's common commands for work

1. grep====================== from Shell script Raiders ================================= Search from file or standard input. -E (E) (equivalent to egrep ) + "Regular expression" + files - o (Output matching text only, can be used

Shell Learning: sed command

  Http://blog.sina.com.cn/s/blog_a56ef5490101cn58.htmlSed is a good file processing tool, itself is a pipe command, mainly in the behavior of the unit processing, you can replace the data rows, delete, add, select and other specific work, the

Shell Script Integer Comparison

1. Integer comparison -eq equals, such as:if [ "$a"-eq " $b"] -ne not equal to, such as:if [ "$a"-ne " $b"] -GT greater than, such as:if [ "$a"-gt " $b"] -ge greater than equals, such as:if [ "$a"-ge " $b"] -lt less than, such as:

Shell-Implemented Calculators

1 #!/bin/bash2 #FUNCTION Calculator3 #AUTHOR Wangbo4 #DATE 2015-09-26567 function Checknum ()8 {9 Expr + 0 &>/dev/null10Case $? Inch12 0)return $14;;15 *)16Read-t 50-p "Please input integer:" int18Check "$int"20Return "$int"2223;;Esac25}26function

Some simple instances of shell scripting

1. Word Frequency statisticsSed-e s/' [[:p UNCT:] '/'/g-e s/' [[:d igit:] '/'/g $filename | tr [A-z] [a-z] | Tr ' \ n ' | Tr ' \ n ' | Sed '/^$/d ' >>newfilename#干掉文本中的标点和数字#替换大小写#替换换行符为空格后再替换空格为换行符 (may not be necessary)#删除空行重定向到新文件Sort newfilename|

Common judgments of shell scripts

-e filename true if filename exists-d filename If filename is a directory, true-F filename True if filename is a regular file-L filename True if filename is a symbolic link-r filename If filename is readable, true-W filename if filename is writable,

Regular expressions in the shell

The essence of the shell is to convey a series of commands or signals to the system, usually in the form of a command plus a large string of characters. This string of characters is the character used to express meaning, which is the regular

Comparison of $@ and $* in the shell

[email protected] ceshi]# cat test.sh#!/bin/bash# test.shecho "-------------ISF is set to \"-seperator\ "------------"Ifs= "-seperator"; # Note that there is a minus sign (-) before SeperatorFor i in "[email protected]"; Do echo "@ ' $i '"; DoneFor

2.0-shell Interrupt continues to exit

Several key words in the Shell control loop break continue exit#!/bin/bash#在1-loop in the 10 sequence, if the sequence equals 5, the number is not displayed and the loop is interrupted to continue with the successor task.For i in ' SEQ 1 10 'DoIf

Shell Scripting Exercises

20,150,722 Week Three1. Generate a log file daily according to the format xxxx-xx-xx, for example, the file generated today is 2013-09-23.log, and the disk usage is written to the file.#vi/usr/local/sbin/crontest1.sh#!bin/bashd= ' date +%f '

Shell script: Exiting the loop

The shell also uses break and continue to jump out of the loop.Break commandIn the following example, the script enters a dead loop until the user enters a number greater than 5, using break to jump out of the loop.#!/bin/Bash while : Do

Shell and Shellscript

1. Variable Reading example: Echo $PATH echo $ (PATH)2, Variable assignment: AA=ASDF Note: There is no space around the equals sign3. View all environment variables: env4. Id:echo $$ of the current thread5. Custom variable to environment variable:

Realizing external network access to svn--peanut shell +visiualsvn in LAN to realize extranet access to SVN (iii) in LAN

After the first two articles, so far, we have acquired the external domain name and set up the SVN server, next, we will summarize how to implement access to the local area network.1. Install VISIUALSVN Server (visible: http://blog.csdn.net/lu930124/

In Linux, the shell variable $ #, $ @, $0, $1, $2 has the following meanings :,

In Linux, the shell variable $ #, $ @, $0, $1, $2 has the following meanings :, Variable description: $ PID (ProcessID) of Shell itself $! PID of the background Process last run by Shell $? End code of the last command (Return Value) $-Flag list

Shell script to delete the folder N days ago ----- the difference between the date command on linux and mac

Shell script to delete the folder N days ago ----- the difference between the date command on linux and mac Background:Every day you build things and put them in different folders by date. For example, today's construction is put in, tomorrow's will

Total Pages: 541 1 .... 495 496 497 498 499 .... 541 Go to: GO

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.