Linux shell and awk statistics log number of visits to the same IP

awk Statistics IP Access times Now there is a file, the amount of data in the 200多万条 record, want to use the shell of awk to do statistics, the file format is as follows#关键字 #url#ip Address #Test|123|1Test|123|1Test|123|2Test2|12|1Test2|123|1Test2|1

Linux Shell Curl Command gets the HTTP status code

By curl the-w parameter we can customize the output of the curl,%{http_code} represents the HTTP status code The code is as follows Copy Code # curl-i-M 10-o/dev/null-s-W%{http_code} www.111cn.net The above

Shell Judgment Statement--Example interpretation

1 if statementThe format of the IF statement:If condition then command fiIf condition then command else command fiIf condition then command elif condition then command else command fiExample:Determines whether the current user is root, and if so,

Special symbols in the shell

* Multiple? 1 x# annotation Characters\ de-Righteous characters| Pipe character$ as a prefix for variables, used for variables!$ using the last parameter of the previous command; Used in the middle of two commands to write in one line~ User's Home

Linux-shell Exercises (I.)

1, realize the bulk add 20 users, the user name is user1-20, password is user+123#!/bin/Bashcount=$1if[-N"$count"]then for((i=1; i)) DoUseradd-d/home/user_$i-s/bin/bash user_$i; Echo User_"$i"123|PASSWD--stdin user_$i; DoneElseEcho"$count is

The Shell in Linux

What the shell means: First, the Shell's English meaning is "shell"; It is relative to the kernel, because it is proposed to be based on the core of a user-oriented form of expression, such as we see a ball, see its shell, rather than nuclear.

Use the most frequently occurring IP in the shell script statistics file

For example, there are the following files Test.txt1 134.102.173.432 134.102.173.433 134.102.171.424 134.102.170.9To count the most frequently occurring IPs, you can take advantage of the following shell script:Cat Test.txt | awk ' {print $} ' |

Linux Shell Basics

I. File systems and Securitychmod commandThe chmod command has two modes, one is the symbol mode, executes the user with the Ugo, executes the permission with the RWX, the other is the absolute mode, uses the different value of the octal different

Shell processing input

1, when the script is run to specify parameters, directly behind the script name to follow the parameters to be added, in the process of running, "$" represents the program name, "$" represents the first parameter, the second parameter, the Nineth,

Shell in && | | How to use

Shell in && | | Usage && operator:  command1  && command2 && Left command (Command 1) returns True (that is, returns 0, successfully executed) after,&& The command on the right (command 2) can be executed, in other words, "If this command executes

Shell Basics-variables, judgments, loops

1. Shell basic format, variable# Add an interpreter to the shell script #! /bin/bash# Print out Hello world with a script#! /bin/bashecho "Hello World"ExitParameters: A parameter is an entity that stores real values that are typically referenced in

Shell and regular expressions

Shell expressionWhether the-D file exists and is a directoryThe-f file is present and is a normal fileWhether the-W file file exists and is writable-s file exists and is not empty-N string string length not 0String1=string2 string Equality-eq equals-

Bash Shell analog Password input

function inpasswd {Read-s-P "Enter you Password:" Passwd1EchoRead-s-P "please Check Password" passwd2Echoif [[$passwd 1 = = $passwd 2]]Thenecho "correct" && exit 1Elseecho "Incorrect"echo "Please Input Agin"Fi}Count=1While TrueDoIf [$count-GT

Shell periodically deletes files before the specified time

TemplateCat delbak.sh#!/bin/shlocation= "/root/sqlbak/"Find $location-mtime +30-type f |xargs rm-fPs:Location is the directory where the lookup is set--mtime +30 is set time is 30 days ago-type F this week the type of lookup is fileThen add crontab

Shell Programming Basics must know

Shell programming################################################Static languageDynamic language################################################Programming languages: Machine language, assembly language, advanced languages############################

Shell script Bulk Modify file name

Before modifying the file name#!/bin/bask#for A in $ (ls/etc/yum.repos.d/centos*);d oif [$a! = '/etc/yum.repos.d/centos-media.repo '];then #CentO The S-media.repo file name does not modify the MV $a $a. bak

debugging shell scripts in Linux

The original script check.sh:Monfile= "/var/log/test/testmon.txt"Logfile= "/var/log/test/testmon.log"Touch $monfile...The script is edited in window and uploaded to Linux after editing.Problem:After running, the file that appears in the directory is

Write a shell every day.

1. Read basic reading 1 #!/bin/bash 2 #testing the Read command 3 4 Echo " Enter you name: " 5 Read name # 6echo"Hello $name, Welcome to my program. " Perform:#./read. SH Enter

Shell script implementation randomly sampled class students

Tag:style   date    Implementation    bin   nbsp    and    extracting    cti   bsp    #/bin/bashfunction rand () {min=$1Max=$ ($2-$min +1 ) num=$ (date +%s%N)Echo $ (($num% $max +$min))}rnd1 the ) JW=(Wang Hao Shein Huang Yang Hoxing Yu Hu Jiang

Linux Shell Text filtering

Regular Expression - concept: A special syntax for describing text patterns -by ordinary characters (e.g., characters A to Z), and special characters (metacharacters, such as/ *?). And so on) make up a matching string--the text Filter tool supports

Total Pages: 541 1 .... 524 525 526 527 528 .... 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.