#!/bin/bashwhile read Linedo for file in/home/local/test/* does if test-f $file then sed-n "/${line }/p "$file >>/home/local/out.txt fi Donedone Task: To file from the Home/local/test folder belowFile_1.logFile_2
If you want to intercept a string, you can do it by manipulating the subscript or pointer in C + +, and in a shell script, there are several ways to do this if you want to specify a string for interception:The following examples are used:str=
Linux There are eight ways to intercept a string. Suppose there is a variable var=http://www.aaa.com/123.htm.1. # Intercept, delete the left character, leave the right character. The code is as follows:Echo ${var#*//}where var is the variable name
The first thing to know about scripting languages is that they are usually referred to as the parser for the command line interface. (from Wiki's explanation)Part I: Understanding the shellYou can see that #!/bin/sh and!/bin/bash are used here. But
Thank you for the 36,000 sectionCommon Shell Categories:
BASH: is the GNU Bourne Again Shell, which is the default shell on the GNU operating system
C Shell: The BSD version of Sun's shell
Look at where the shell is on the
before starting the code, let's take a look at what a shell is. Shell English is also called the shell layer. In a computer, "system" software that "provides user interface", usually refers to the command parser of the command line interface. In
Start shellThe GNU Bash Shell provides interactive access to Linux systems. He runs as a regular program and usually starts when the user logs on to the terminal. When you log in, you start the shell based on the user profile/etc/passwd./ETC/PASSWD
Install the required plug-inEmail Extension Plugin GIT Plugin Publish over SSHInstall MAVEN JDK configuration e-mail triggers and other configuration login keys on a chapter blogNew MAVEN Project650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/
1. Requirements backgroundFor large companies, there must be a site or configuration file updates from time to time, and the use of the machine is certainly a lot of units, less than a few, more than dozens of or even hundreds of sets. Therefore,
Writing SQL in MyBatis, such as SELECT, involves a long list of names.'int (null auto_increment, ' name ' varchar (COLLATE) utf8mb4_bin, ' mainimg ' varchar (null,... Now you want to convert the column names in the table description to a
This program mainly implements the Hive permission test. The system has the Administrator user single and test user tests. Under Path/home/test/, the pre-condition of the use case is written in the input folder, and each use case corresponds to an
#while循环: Used to continuously execute a series of commands and to read data from input files; commands are usually test conditions#格式如下:#while expression#do# Statement to being executed if expression is true#done#命令执行完毕, control returns to the top
#!/bin/bash# above is the shell script interpreter, which must be written at the beginning to represent the shell script. /bin/sh is more used under UNIX and features less than Bash. Use/bin/bash more, but/bin/sh is/bin/bash soft link in Linux.#
First, Judge read the string value
An expression
meaning
${var}
Variable var with the same value as $var
${var-default}
If Var is not declared, then use $default
1, variable var from npos∈[0, Length-1] bit start, from left-to-right intercept num characters: ${var:npos:num}Summary: If NPOs If NPOs > Length (Var)-1 Then the result is an empty string;If the character does not actually meet the NUM bit, it is
In shell script, $* and [email protected] Both get all command-line arguments, but there is a slight difference between the two in use, the difference is mainly in the use of double quotes, that is, the direct use of $*,[email protected], or use "$*"
LinuxLinux CSHRC file functionsHow Linux processes/view process/kill processWhat permissions does Linux file 755 represent?Linux worker threadsLinux inter-Process communication methodPipeline,msgq ...Inter-process Communication _ Baidu
1. IfSyntax format for IFif Conditon Then Command1 command2 " commandnfi2. If Elseif Conditon Then Command1 command2 " commandnelse Command1 Command2 "' commandnfi3. If ElseIf elseif Conditon Then
1. Data type:StringArray2. Naming conventions for variables:Can only start with a-Z or a-ZCannot have spaces in the middle, you can use _Punctuation cannot be usedCannot use the SHELL keyword3. Variable type:Environment variablesLocal variablesShell
Share a concurrent script that simulates multithreading under Linux, using this script to execute related commands on a defined number of servers at the same time, which is much more efficient than a normal for/while loop and can be executed in a
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.