File22924 183.136.221.76 20020747 119.146.204.15 20019563 61.182.133.37 20019150 112.85.218.29 20018002 113.106.128.3 200123 113.106.128.3 200
File B113.106.128.31.1.1.161.182.133.37
Ladies and gentlemen, how can we print out all the records of
The test statement must have spaces before and after the equal sign, and there can be more than one space. To promote it, there must be no spaces before and after the equal sign of the value assignment statement, non-assignment statements require
1,Echo $?: An exit status is returned when any command is running, and the exit status of the previous command is output,0Indicates that the exit is successful.
2, Test File status:[-W text]Test whether the file can be written,Echo $?The output is0
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
Compare shell strings and determine whether the string is a numberBinary comparison operator, which compares variables or numbers. Note the difference between numbers and strings.
◆ Integer comparison
-EQ equals to, for example, if ["$ A"-EQ "$
◆ Parameter description-B. returns true if the file exists and is a block file.-C: returns true if the file exists and is a character file.-D. If pathname exists and is a directory, true is returned.-E: returns true if the file or directory
InShellProgramming.You can use parameters.ShellLocation and Internal Parameters
1
,Location parameters
The parameters provided by the system are called location parameters. The value of the location parameter can be used $ N Get, N Is a
#/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 $
The daily log analysis team is really sorry. We often need to provide statistics such as PV, UV, and independent IP addresses. C/C ++ and Java can all be used to write logs. The process is like this, first, read the file, scan it row by row, put the
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
This script was modified on the cache cleanup script of Zhang banquet, mainly to add the if option, and select the address of the cached file based on the $1 parameter type (because $1 is not fixed, sometimes it is a specific JPG type, sometimes it
Command line parameters,
Positional Parameter
$0Complete program name(BasenameCommand to remove the path)
$1The first parameter, exceeding9Hour$ {10}
$ #Number of parameters
$ *All parameters in the command line, as a word
$ @All parameters in the
Ls
-L, show the hard link count;
-I, show I-node
-H, human readable
-T, sort by modify time
-S, sort by size
-R, -- reverse
-R, show content of sub-Dir
-V, sort by version
CP
-P,Retain source file attributes, such as the modification time
-L,
1. Read options
Read can have eight options:-A,-D,-E,-N,-P,-R,-T, and-s.
-: Read the content into the value
echo -n "Input muliple values into an array:"read -a arrayecho "get ${#array[@]} values in array"
-D: Delimiter, that is, the delimiter.
I. Shell Condition Statement (if usage)
If statement structure [if/then/Elif/else/FI]
If condition test statement
Then
Action
[Elif Condition
Action
Else
Action
]
Fi
If you are not clear about the conditional test statement, refer
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