Shell reads file contents

Shell scripts that perform fast and easy to understand code. In the process of writing shell code, it is often used to read the file contents. Notation One:----------------------------------------------------------------------------#!/bin/bash while

Shell script, how awk handles two rows in a file that are associated with the upper and lower lines.

File D.txt The following contentGGG 1portals:192.168.5.41:3260Werew 2portals:192.168.5.43:3260How to change the file D.txt content to the following contentGGG 192.168.5.41:3260Werew 192.168.5.43:3260Problem Solving Ideas:[[email protected] study]#

Shell Small Script

1#! /bin/Bash2 3j=04 forIinch "[email protected]"5 Do6j=$ (($j +1)) #累加计算7 Echo-E"$j \c"8 Echo$i9 DoneTen One A while[[ $1= -* ]]; Do#匹配-back with any value - Case$1 inch --D) debug=1 ;; the Esac - Shift - Done -action=$1 + Shift

Script shell increments the task every hour

The following hello is the start time, world is the end time#!/bin/Bashstart=$(Date+%s); Hello="20160911 xx" World="20160911"Datebegin=`Date-D"$hello" "+%y%m%d%h"' DateEnd=`Date-D"$world" "+%y%m%d%h"` while["$datebegin"-le"$dateend" ]

Shell Programming-cont.

Shell scripts can be seen as a stack of commands, implemented by combining command flow control mechanisms.The interpreter #!/bin/bash or/usr/bin/python is also known as ShebangThe generic script needs to give execution permission, or you can use

function call path process analysis from Spark-shell to Sparkcontext (source code)

  No hurry, step-up, first lay a good foundationThe Spark Shell principle  First, we clearly locate the few.1, Spark-shell2, Spark-submit3, Spark-class4, Sparksubmit.scala5, Sparkiloop.scalaSource Code of InitializesparkDef Initializespark () {

Shell script to check if host is alive

1#!/bin/Bash2prefix=192.168. the3num=14 while["$num"-lt"255"]; Do5 Echo-en"Pinging ${prefix}.${num} ..."6 Ping-c1-w1-t5 ${prefix}.${num} >/dev/NULL 2>&17 if["$?"-eq"0"]; Then8 Echo "OK"&&Echo"${prefix}.${num}" >>Ok.txt9 ElseTen Echo "Failed"&

Shell Script Raiders (learning notes)--1.3 Command logical execution order

You can use the semicolon ";", the double ampersand "&&" and the Double vertical bar "| |" in Linux To connect multiple commands.1.3.1 Semicolon;When multiple commands want to be executed at the same time on a single line, a semicolon ";" can be

Shell Display with color font

Format: echo "/033[word background color; font color m string/033[control code"If you simply display the font color can be fixed control code bit 0m.Format: echo "/033[word background color; font Color m string/033[0m"Word background color range: 40-

Run shell scripts every 30 seconds

cd/usr/local/sbin///Store shell script directory.Vim guoguosql.sh//Run a PHP file every 30 seconds. File path is vim/home/wwwroot/www/domain/huitiao/web/sql.php#! /bin/bashand do Curl http://127.0.0.1:82/sql.php sleep -DoneSh/usr/local/

Linux Shell Common directives

1. Man helps explain commands you are familiar with or unfamiliar with Eg:man ls to view LS-related usage Note: Press the Q key or CTRL + C to exit, under Linux you can use CTRL + C to terminate the current program run. 2. LS to view the

Common statements for Linux shell scripts

Linux shell directives such as-D,-F,-e are judged by :File comparison Operators-e filename true if filename exists [-e/var/log/syslog]-D filename True if filename is a directory [-d/tmp/mydir]-F filename True if filename is a regular file

Linux Classic Shell command collation

Linux Classic Shell command collation1. Delete a 0-byte fileFind-type f-size 0-exec rm-rf {} \;2. View the processSort by memory from large to smallPS-E-O "%c:%p:%z:%a" |sort-k5-nr3. By CPU utilization from large to small arrangementPS-E-O "%c:%p:%z:

HDU5730 Shell Necklace (DP + CDQ + FFT)

TopicsSourcehttp://acm.hdu.edu.cn/showproblem.php?pid=5730DescriptionPerhaps the sea ' s definition of a shell is the pearl. However, in my view, a shell necklace with n beautiful shells contains the most sincere feeling for my best lover Arrietty ,

Shell Programming Learning

1. Crontrab for Linux in the projectScheduled execution under Linux is mostly done using a custom plan in the crontab file, but it's not very complex, and it's basically remembered once and for all, and the key is to remember the/var/spool/cron

&& in Linux shell | | and ()

1. Introduction of the Linux command return valueWhen the shell executes a command, it has a return value that is stored in the shell variable $?. When $? is 0 o'clock, the command execution succeeds; when $ = 1 o'clock, the command execution fails.2

Shell Programming Overview and variables

Dynamic language: Interpreted language, is a weak type of language, Characteristics: Edge interpretation edge execution. Example: PHP, SHELL, Python, PerlWeak: variable time declaration, or even type-insensitive.Strong: Variables must be declared

99 multiplication table for shell scripts

A 9x9 multiplication table was written with a shell script, for reference only! Text below ...650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/87/53/wKiom1fc_6mT0-TPAABEz2kbGyk527.png "title=" 99.PNG "alt="

Spark-shell Study Notes

1.Val lines=sc.textfile ("hdfs://") = = Loaded comes in as an rdd resilient distributed dataset elastic data setVal Errors=lines.filter (_.startswith ("ERROR")) # #transformationVal errors.persist () # #缓存RDDVal Mysql_error=errors.filter (_.contains

Write a bash shell script

Write a bash shell scriptThe script is as follows: it is used to monitor the number of mongo connections and restart the system.#! /Bin/bash# Source/etc/profileConn = '/usr/bin/mongo -- quiet Db. serverStatus (). connectionsExitEOF`Conn1 =$ {conn #*:

Total Pages: 541 1 .... 357 358 359 360 361 .... 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.