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
1) Unix command:
Although any Unix command can be used in shell scripts, some more common commands are used. These commands are usually used for file and text operations.
Common command syntax and functions:
Echo"Some text": print the text on
What is Shell? Shell is a program with special functions. It is an interface between the user and the core program (kernel) of the UNIX/Linux operating system. Why do we say shell is an intermediary between the core program of the system and the
Shell basic syntax
Basic shell Syntax:Like advanced programming languages, shell also provides instructions and functions for using variables.For shell, the value of all variables is a string, and the shell program uses $ VaRReference the value
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
Shell is like the editor: everyone has their own choice and tries to defend the choice and tell you why it should be used ). Indeed, shell provides different functions, but they all implement the core concept of development decades ago.
I used
String-related operations are often involved in the shell batch process. There are a lot of command statements, such as: awk,sed can do various operations of string. In fact, the Shell has 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 '
Linux Shell String Operations (length, find, replace) a detailed description of string-related operations is 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,
Shell is like the editor: everyone has their own choice and tries to defend the choice (it also tells you why the choice should be used ). Indeed, s
Shell is like the editor: everyone has their own choice and tries to defend the choice (it also
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.