String-related operations are often involved in the shell batch process. There are a lot of command statements, such as: awk,sed can do string various operations. In fact, the shell built a series of operating symbols, you can achieve similar
Copy Code code as follows:
Examples of string operations in work
Filename= '/home/admin/jobs/cnclickstat/dfsloader/loader.cfg '
#下面是使用shell字符串操作
buname1=${filename#*/jobs/} #去除 '/home/admin/jobs/cnclickstat/dfsloader/loader.cfg '
The cloud-dwelling community has also made relevant articles before. Here, we recommend that you use some of the built-in functions.
String-related operations are often involved when writing a shell program. There are many command statements, such
This paper brings together the common functions in ASP
function Syntax function LenLen (Stringvarname) returns the number of characters within a string, or the number of bytes required to store a variable. TrimTrim (string) to remove spaces before
${#string}Returns the length of the $string
${string:position}In $string, start extracting substrings from the $position position
${string:position:length}In $string, the $length-length substring is extracted from the $position
Today, when writing the constructor method, there is a small problem, caused by this problem a series of thinking, in a Java class in the initialization of variables and classes what is the order of execution?# # problems
Objective-C [NSMutableString], nsmutablestring-------------------------------------------NSMutableString(1) Basic concepts of NSMutableStringThe NSMutableString class inherits the NSString class. NSMutableString is a string linked list. It can
${#variable} Returns the length of the $string${variable:position} in $string, start extracting substrings from position $position${variable:position:length} in $string, start extracting substrings of length $length from the position
During shell programming, you often encounter the problem of getting the file name and file suffix. The general solution is as follows:
1 # Code 2 file = " thisfile.txt " 3 echo " filename :$ {file %. *} " 4 echo "
Special characters
Purpose
Description
$ Variable
Get the value of a variable. If it is not initialized, It is null.
Returns the value of "variable". If it is not initialized, null is returned.
$
PHP Verification Code Small Project:Header (' Content-type:image/jpeg ');$img =imagecreatetruecolor (120,40);//Build image$element =array (' A ', ' B ', ' C ', ' d ', ' e ', ' f ', ' g ', ' h ', ' I ', ' j ', ' K ');//Captcha random letter, set
Linux shell string operation detailed (length, read, replace, intercept, connect, compare, delete, position) 1. Linux Shell intercepts the first 8 bits of a character variableThere are several ways to implement this:
Expr substr "$a" 1 8
Ext.: http://justcoding.iteye.com/blog/1963463String-related operations are often involved in the shell batch process. There are a lot of command statements, such as: awk,sed can do string various operations. In fact, the shell built a series of
Linux shell String Operations (length, find, replace) detailedString-related operations are often involved in the shell batch process. There are a lot of command statements, such as: awk,sed can do string various operations. In fact, the shell built
Linux Shell String Operations (length, find, replace, match) detailedString-related operations are often involved in the shell batch process. There are a lot of command statements, such as: awk,sed can do string various operations. In fact, the
Problems with the interception of shell strings:The Linux shell intercepts the first 8 bits of a character variable, with the following methods:1.expr substr "$a" 1 82.echo $a |awk ' {print substr (, 1,8)} '3.echo $a |cut-c1-84.expr $a: ' \ (. \ \).
String-related operations are often involved in the shell batch process. There are a lot of command statements, such as: awk,sed can do string various operations. In fact, the shell built a series of operating symbols, you can achieve similar
String-related operations are often involved in the shell batch process. There are a lot of command statements, such as: awk,sed can do string various operations. In fact, the shell built a series of operating symbols, you can achieve similar
1, the shell variable statement judgment
An expression
meaning
${var}
Variable var with the same value as $var
${var-default}
If Var is not declared, then use $default as
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.