Shell script handles text files && space transformation lines line by row

Reference: http://www.cnblogs.com/dwdxdy/archive/2012/07/25/2608816.html Often to the stylistic document for line-by-row processing, in the shell how to obtain each row of data, and then processing the row of data, and finally read the next line of

Hadoop Execution Shell Script

Share a shell script executed by your own Hadoop, But for those who write shell scripts, it's not going to work. People who can't write shell scripts seem to be confused. If you are interested in learning, you can contact in private. As for The

Shell string Matching

Question: How does the shell judge a filename to start with a character ~ Solve: #var = "cn get the length of me" #$1:parameter 1 to judge the name of the file Var=$1 Iscn=false # ${var:0:2} takes the Var substring from the No. 0 character and

Three methods of string segmentation in shell

Question: For string output such as ' 1,2,3,4,5 ', separate 1 2 3 4 5 Feature: no spaces in string Workaround 1: #!/bin/bash var= ' 1,2,3,4,5 ' var=${var//,/} #这里是将var中的, replace with space for element in $var do echo $ Element done

Basic Shell Programming __ programming

if else and greater than, less than, equal to logical expressionIf ...; Then .... Elif ...; Then .... Else .... fi [F "somefile"]: judge whether it is a file [-X "/bin/ls"]: Determine if/bin/ls exists and has executable permissions [-N ' $var]:

Shell Scripting Basics-writing runs

Write: The shell script is actually a plain text file (ASCII), and we can edit the file to help us execute multiple instructions at a time, or use some operational and logical judgments to help us achieve certain functions. The same considerations

A small calculator compiled with a Linux shell __linux

#!/bin/sh Echo-n "Welcome to I programming World" Echo-n "This program is a calculator" Operator= "+-x/exit" echo "Please input two digits:" Read Number1 number2 Select I in $operator Todo Case $i in +) result=$ (($number 1+ $number 2))

Shell Script Logical Backup Database

[Zxw@host1 ~]$ nl shscp/dump_backup_my.sh1 #!/bin/bash2 #dump MySQL data once per day, the reserve last 7 days data.3 #zhao Xiaowei4 #2014.08.275 Path=/bin:/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin:~/bin6 Export PATH7 dir=

Shell Sort Command-sort

The sort command sorts multiple rows of data in a behavior unit.For example, there is a text file Test_sort, which has five elements, using the sort command, the five elements can be sorted in dictionary order from small to large.If the sort command

Shell reads multiple files at the same time

Read two files at the same time, and merge their peers into one line to write to a merged file Shell script: #!/bin/bash #set -x CD ' dirname ' $ '/. / inas_script_root= ' pwd ' function Make_if_no_existis_dir () {local dir=$1 if [!-e ' $

Linux uses shell scripts and cron to implement timed backups, uploads, and garbage-log Cleanup (original) __linux

1. Edit detailappbackup.sh Input: #!/bin/sh#copyright (c) 2010-2011 Luoch (luocheng.cn@luocheng.cn) #Backup The detail files and update, clear logs#version 0 .1.1echo "= = Start deleting logs = =" Rm-vf ' find/opt/apache/htdocs/detail/app/log-name '

Shell Restart Tomcat Script

#! /bin/bash tomcat_home=/usr/local/tomcat6 shutdown= $tomcat _home/bin/shutdown.sh starttomcat= $tomcat _home/bin/startup.sh echo "Off $tomcat_home" $SHUTDOWN ps-ef |grep Tomcat |grep $tomcat _home |grep-v ' grep ' |awk ' {print $} ' | Xargs kill-9

Write data to SOLR incrementally using the Shell timer task

1. Write the shell script: #!/bin/bash # Performing an incremental import of solr/userinfo Curl ' http://localhost:8983/solr/userinfo/dataimport?command= Delta-import&clean=false ' Echo ' solr-core:userinfo delta-import success. ' 2. Add

First knowledge of the shell

First, the shell concept shell本身是一个用C语言编写的程序,它是Linux系统的用户界面,提供了用户与内核进行交互操作的一种接口。shell既是一种命令语言,又是一种程序设计语言。作为命令语言,它交互式地解释和执行用户输入的命令;作为程序设计语言,定义了各种变量和参数,并提供了许多在高级语言中才具有的控制结构,包括循环和分支。 它虽然不是Unix/Linux系统内核的一部分,但它调用了系统核心的大部分功能来执行程序、建立文件并以并行的方式协调各个程序的运行。

Variables of Shell programming

Variable setting rules1. Variable names can consist of letters, numbers, and underscores, but cannot begin with numbers;2, in bash, the default type of the variable is a string, if you want to do numeric operations, you must specify the variable

Shell Scripting Exercise A

ifMulti-branch statement practice#!/bin/bashread-p " Please enter 100 m running seconds: "IIf [$i-lt] && [$i-GT 0]Thenecho " Enter the final "read-p " enter male and female "aif [$a = male]Thenecho " into the men's group "elif [$a = female]Thenecho "

Write a script that requires timed execution into a scheduled task with the shell

Write to a system-level scheduled task echo "*/5 * * * * python /data/web/s1/a.py >> /data/web/s1/insert.log" >> /etc/crontab cat /etc/crontabWrite user-level scheduled Tasks [[email protected] update]# cat crontab.txt */5 * * * * python

Shell Script Basics

Shell script: A text file that contains some commands or declarations and conforms to a certain format Format requirements: First line shebang mechanism #!/bin/bash #!/usr/bin/python #!/usr/bin/perl The

exec parsing in Shell under Linux

Both exec and source belong to the Bash Internal command (builtins commands), where you can view all the internal command information by entering man exec or man source under bash.The bash shell commands are divided into two categories: external

Shell Kill Tomcat Process

First, killandclean.sh#!/bin/bashpid= ($ (ps-ef | grep tomcat | egrep-v grep | awk ' {print $} ')) length=${#pid [*]}if [$length-gt 0] thenfor i in $pid does ' kill-9 $i ' done with echo ' kill over ... '

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