Linux shell String Operations (length, find, replace) detailed

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

Use shell scripts to slice task_list and execute separate scripts

1#/bin/SH2 3task_list=$14Len= 'WC-L $TASK _list |awk '{print $}'`5 6 #noExce () {7 sed-N'1,'$ (((len/5) ))'P'$TASK _list > $TASK _list'Task_list1'8 sed-N"'$ (((len/5)*1+1))','$ (((len/5)*2))'P'$TASK _list > $TASK _list'Task_list2'9 sed-N"'$ (((len/5)

Linux command--bash Shell configuration

I. Type of shellIn terms of user login, the shell type is:1. Login Shell: (read environment configuration)Log in normally via a terminal:Su-usernameSu-l USERNAME2, non-logon shell: (do not read the environment configuration)Su USERNAMECommand window

Special characters in the shell

Introduction [54,17] Bash itself does not support regular expression regex, while some tools under the shell support the interpretation of Regex , and the use of regex is Shell commands and tools , such as Grep,sed,awk. but the shell supports

Shell script: Print 99 multiplication table

Shell script: Print 99 multiplication tableToday in three different ways to achieve the shell script Print 99 multiplication table, the code is as followsMethod 1: Use a For loop (a.sh)#!/bin/shfor i in {1,2,3,4,5,6,7,8,9}do to J in {1,2,3,4,5,6,7,8

Shell modified file name (a)

If the file name is: Time_filename.txt changed to Filename_time.txt. For example 20111111_me.txt change to me_201111111.txt how to modify?1#! /bin/SH2 forEachfileinch`ls-B '3 Do4Filename=${eachfile%. txt}5Filehead= 'Echo$filename |awk-F _'{print $}

Day: Shell programming Basics and writing Makefile

One: Shell Programming basicsShell definition: The shell is a program that acts as an interface between a user and a Linux system. It allows the user to enter commands that need to be executed to the operating system. There are many shells in the

Shell Basics (ix) function

function allows us to divide a complex function into several modules, which makes the program structure clearer and the code reuse more efficient. Like other programming languages, the Shell supports functions as well. The Shell function must first

Linux shell Programming

1. What is Shell The shell is the user interface of the system and provides an interface (command interpreter) for the user to interact with the kernel. The shell receives the user's input command and feeds it into the kernel to perform the

Description of case command in Shell under Linux (regular break, unconditional continuation and conditional continuation)

The case name in the shell under Linux is similar to the switch in C + +, but cases in the shell are more powerful and complex.1, strong mainly reflected in: Shell in case the keyword can be a string type, and each item can contain regular

Linux Shell $ $n $* $# $$

Give you a full, you in the Linux environment to try to understand more:The execution name of this program$n the nth parameter value of this program, n=1..9$* all parameters of this program, this option can have more than 9 parameters.$# the number

Use Shell to view Apache IP traffic under Linux

1. View TCP connection StatusNetstat-nat |awk ' {print $6} ' |sort|uniq-c|sort-rnNetstat-n | awk '/^tcp/{++s[$NF]}; END {for (a in S) print A, s[a]} 'Netstat-n | awk '/^tcp/{++state[$NF]}; END {for (key in) print key, "T", State[key]} 'Netstat-n |

Linux shell scripting Exercises

One#!/bin/bash#自动添加用户, and make the initial password a user account name, and force the user to change the password when they log onI=1While [$i-le 15]DoIf [$i-le 9]ThenUseradd user0$iecho "User0$i" | passwd--stdin user0$i &>/dev/nullchage-d 0 user0$

Linux process management and shell scripting

Use! To invoke past commands.!! Repeat the previous instruction!a Repeat the previous instruction, led by a!nubmer Repeat the previous instruction to record numbers in the history table!-number Repeat the previous number instructionAilas abc= ' CD

Shell Learning & | what is the difference?

Tag: Shell Before answering the questions in this chapter, let's first understand the concept of return value!Each Command or function we run in shell will return a value of the parent itinerary at the end,Return Value.Available in shell command

Shell variables and string operations

By default, bash shell is a non-typed footfall language. Unless specifically declared with declare, it does not distinguish whether a variable is an integer variable, a floating point variable, or a string variable. All variables in bash shell are

Differences between login shell and non-Login Shell

Before the introduction, I first thought about a question: Sometimes we fail to enter the user's shell environment after switching the user through the su command. Why? Login Shell:Complete logon process is required when Bash is obtained. That is to

How does Shell obtain parameters?

  How does Shell obtain parameters? When writing a shell script, you often need to obtain parameters from the outside, for example: $ sh demo.sh a So how can we upload the above parameter A to the shell program.$0 $1... $10, where $0 is the name of

How to Set a command prompt in Shell

First, you must check that the shell you are using is the shell. Echo $ Shell   Bash settings The bash prompt is determined by the variable PS1. You need to see your own PS1 settings and run the command $ Set | grep PS1 You can see it. Similarly,

Shell: displays the basic system information script and shell basic information script.

Shell: displays the basic system information script and shell basic information script. #! /Bin/bashecho "IP:" ifconfig | grep "inet addr" | grep-v 127.0.0.1 | awk '{print $2}' | awk-F ': ''{print $2} 'echo" Product Name: "dmidecode | grep Nameecho"

Total Pages: 541 1 .... 211 212 213 214 215 .... 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.