Shell cut command usage

Similar to awk Functions Example 1 $ A = 'echo root: X: 0: 0: Root:/root:/bin/bash | cut-D: -F 1,5 'shuohailhl @ shuohailhl-PC/cygdrive/d $ echo $ aroot: Root In the preceding example, the root: X: 0: 0: Root:/root:/bin/bash command is

Basename, dirname Shell

Basename is the name left after the directory is removed.Example: shell> temp =/home/temp/1. TestShell> base = 'basename $ temp '(reverse quotation marks)Shell> echo $ BaseResult: 1. TestDirname is the DirectoryExample: shell> temp =/home/temp/1.

How to cancel redirection in a shell program

/*************************************** ******************************* Author: Samson* Date: 08/18/2012* Test Platform:* GNU Linux version 2.6.29.4* GNU bash, version 4.0.16 (1)-release (i386-redhat-linux-gnu) ************************************

Shell string Truncation

Linux ShellTruncation character variableThe first 8 bits of the signature are as follows:1. expr substr "$ A" 1 82. Echo $ A | awk '{print substr (, 1, 8 )}'3. Echo $ A | cut-c1-84. Echo $5. expr $ :'/(.//).*'6. Echo $ A | dd BS = 1 COUNT = 8 2>/dev/

How can I obtain the output result by calling shell commands in various compilation languages?

(1) Python //ArticleAs mentioned inHttp://blog.chinaunix.net/u/12325/showart_217175.htmlEither way, And popen. Output = subprocess. popen (['Ls', '-l'], stdout = subprocess. Pipe, shell = true). commun Icate () Print Output [0] Another method is

How to Learn Linux Shell

Example about Linux Shell #! /Bin/bash echo "Hello world! " echo" Hello $ LOGNAME, it's nice talking to you " echo" U present working on a machine is 'uname-N' " echo" U Present working directory is $ (PWD) " echo" Bye for now $ LOGNAME. the time

Common shell string operations

1. String Truncation (1) intercept the string before and after a specified character [Root @ gd86 applications] # Var = Hello: zkl: zyh [Root @ gd86 applications] # echo $ {var %: *} returns the first string from right to left.Hello: zkl[Root @

Difference between $ * and $ @ in Shell

Difference between $ * and $ @ in Shell A little bit about $ * and $ @ is also learned by cainiao. $ *All location parameters are used as a word.Note: "$ *" must be referenced.$ @It is synonymous with $ *, but each parameter is an independent ""

Unix shell programming (4)

Unix shell programming (4)   Cut commandYou can extract the required data fields from the data file or command output.Command Format: Cut-cchars FileChars indicates the characters to intercept, which can be numbers.File indicates a file. If file is

[Mac usage Basics] shell tips (continuously updated)

This article summarizes some of my frequently used shell commands or some short commands. 1. view the compile time of a tool; ll $(which appname) 2. Common for Loops for i in 1 2 3 4 5; do echo "$i"; done; for((i=140;i 3. Commonly Used File

Common commands and syntaxes for grep, awk, and sed in Shell

Common grep command syntax 1. Double quotation marks and single quotation marksWhen you input a string parameter in the g r e p command, it is best to enclose it with double quotation marks. For example, "m y s t r I n g ". There are two reasons for

Study on Shell exported from access: kevin1986

When I went to bed in chemistry today (Khan ......) dreaming, dreaming of penetrating a magic = off PHP injection point, and then happy mouth water flow (..... sleep too much), suddenly woke up, and immediately wrote the dream idea on the paper:

Targeted output of shell commands 2> & 1

Mycommand> mylog.txt 2> & 1 should be the most classic usage. Command results can be output in the form of "%>", % indicates the file descriptor: 1 indicates the standard output stdout, and 2 indicates the standard error stderr. The default value of

Learn shell-1

1. Using securitycrt in the options-> session Options dialog box, there are many options for emulation under terminal. the Linux server has different terminal simulation packages called the terminfo database, each type corresponds to a terminfo File

Shell starts another script for statistics. awk adds the current time in each row

Control script, Stat. Sh PID_NUM=$$PID_FILE=stat.pid#echo "pid : "$PID_NUMPROG_NAME=$0ACTION=$1usage() { echo "Usage: ${PROG_NAME} {start|stop|restart}" exit 1;}start(){ sh ./stat_run.sh & PID_NUM=$! echo "worker pid is " $PID_NUM

Record the shell script execution process and variable values

/*************************************** ******************************* Author: Samson* Date: 08/17/2012* Test Platform:* GNU Linux version 2.6.29.4* GNU bash, version 4.0.16 (1)-release (i386-redhat-linux-gnu) **************************************

Use of Shell functions

Linux scripts are huge and powerful. Definition: Function Name () // function can be omitted { Command } Call: directly use the function name in the script. Of course, you can also include parameters such Function Name parameters (separated by

Make sure that only one process is running in shell.

In Shell, only one process can be implemented at a time:   1. lockf command   2. Simple implementation: I = 'ps-Ef | grep [N] ew_mvbackup | WC-l' if [$ I-GT 1];ThenEcho "wait for the other mvbackup finish! "Exit-1Else # Do something here   3.

Shell programming (2)

The most important script language in Linux is Bash. I will write this (I will only use this :)). Compared with other development languages (such as C), bash is a relatively simple language, mainly used to write some script code, some batch

Linux Shell script instance 1

1. Write a script to calculate the factorial of 10 in a loop. #! /Bin/sh factorial = 1 for a in 'seq 1 10' DO factorial = 'expr $ factorial/* $ a' done echo "10! = $ Factorial "   2. Write a script. After the script is executed, print a

Total Pages: 541 1 .... 447 448 449 450 451 .... 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.