I want to perform frequent operations on a file. To obtain the values of different columns in each row, I know the method isWhile read lineDoEcho $ Line | awk '{print $1}' # obtain the value of the first column in each rowEcho $ Line | awk '{print $2
Shell script:#! /Bin/Bash must pass the first line #! To specify the Current Shell
I. variables:"": Allows you to reference values of other variables using the $ symbol.'': Other variables cannot be referenced. $ is considered as a normal
/* Is also the online answer. I don't know where to find it ......*/
In the Linux Shell environment, input and output redirection is supported, expressed by symbols . 0, 1, and 2 indicate the standard input, standard output, and standard error
RecommendedArticle:
APIS for file path operations in Shell
Http://www.cnblogs.com/fangkm/archive/2009/04/15/1436674.html
I wanted to sort it out by myself, but I found the above article by Google according to the title of the phenomenon, and I
#/Bin/sh
# Add By zhoujf. Free log file;
Dir_list = "/product1/port/bin/ocs_subscriber_import/back"
Log_list = "* 201 *. unl"
Gz_day = 3Del_day = 30Core_day = 7
Cur_time = 'date + "% Y % m % d % t "'Echo "start at [$ cur_time]"
For dir in $
This post was last edited by ps49324955Integer comparison-------------------------------------------------------------EQ equals to, for example, if ["$ A"-EQ "$ B"]-Ne is not equal to, for example, if ["$ A"-ne "$ B"]-GT is greater than, for example,
TR is used to delete control characters in a file or convert characters.Syntax: TR [-C/D/S/T] [set1] [set2]Set1: Character Set 1Set2: Character Set 2-C: complement. Use set2 to replace characters not included in set1.-D: delete all characters in set1
Linux bash calculator is easy to use, at least it is easier to be lazy.
How:
1. Use the command line# Scale indicates the exact number of digits of a floating point.[Root @ hostname ~] # BCBC 1.06Copyright 1991-1994,199 7, 1998,200 0 Free
Do you still remember the regular expression that used to calculate prime numbers? The world of programming is so interesting that you will always be able to see something special. Have you ever thought that you can put your variables and functions
1. Get user input.The parameter is the regular expression that is correctly checked by the input prompt, and the default value is entered.ReturnThe correct user input is returned.
Function get_input (){Prompt = $1RegEx = $2Default = $3If ["x $
Compile a simple shell command parser
Environment:
RedHat 9.0 kernel 2.4.20
VI document editor 6.1.320
GCC 3.2.2-5
Steps:
Step 2: Write the simplest shell command interpreter. This program is taken from apue Example 1-5. The command cannot
This script is used to automatically back up version libraries under the svn directory and traverse the libraries through awk. The advantage of this is that when someone adds a new version library, there is no need to change the code, the program
String comparison: Result
String1 = string2 string1 equals string2: True, otherwise false
String1! = String2 string1 equals to string2: false, otherwise true
-When n string is not equal to NULL: True, otherwise false
-Z string when string is null:
6.3 start the shell Environment
The init_post function comes from the 814 rows of the same file:
811/* This is a non _ init function. force it to be noinline otherwise gcc812 * makes it inline to Init () and it becomes part of init. Text
#! /Bin/sh# The first line is to tell the system who will execute this dumb.
$ ## Number of parameters transferred to the script$ # ID of the current process during script running, often used as the suffix of temporary variables, such as haison. $$!
#! /Bin/bash
A = "one, two, three, four"
# To split $ A, you can:
Old_ifs = "$ ifs"
Ifs = ","
Arr = ($)
Ifs = "$ old_ifs"
For s in $ {arr [@]}
Do
Echo "$ S"
Done
The above code will output
One
Two
Three
Four
Arr = ($ A) is used to
Note: No space is allowed between the left and right sides of "=". The semicolon program 1 # is not required at the end of the bash statement #! /Bin/sh # echo somethingecho "Hello World" Echo "Hello !! "CD/root/export topmkdir./ABC Program 2,
There is no doubt about the strength of shell, which makes it easier for us to confuse us. For example, I have always thought that I am smart and cannot tell you clearly.
In Shell, Parentheses, braces, and variables in parentheses are used 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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service