This article calls the shell script through Java code and passes in the parameter implementation DB2 the database table exports to the file, the code is as follows:Import Java.io.file;import java.io.ioexception;import
The while loop is used to continuously execute a series of commands and to read data from the input file; the command is usually a test condition. The format is:While Commanddo Statement (s) to being executed if command is TruedoneThe command
String-related operations are often involved in the shell batch process. There are a lot of command statements, such as: awk,sed can do string various operations. In fact, the shell built a series of operating symbols, you can achieve similar
Problems with the interception of shell strings:The Linux shell intercepts the first 8 bits of a character variable, with the following methods:1.expr substr "$a" 1 82.echo $a |awk ' {print substr (, 1,8)} '3.echo $a |cut-c1-84.expr $a: ' \ (. \ \).
If the file name is: Time_filename.txt changed to Filename_time.txt. For example 20111111_me.txt change to me_201111111.txt how to modify?1#! /bin/SH2 forEachfileinch`ls-B '3 Do4Filename=${eachfile%. txt}5Filehead= 'Echo$filename |awk-F _'{print $}
Phenomenon: Hourly data in hive tables, which are missing one hours every few days, are found to fail when data aggregation cat is done, resulting in: Modify the script to do the following solution: # #merge 5min data into hour data
In the shell, the command execution succeeds with a return value of 0, and the unsuccessful return value is not 0Logic with:Shell 0 is true, not 0 is falseWhen the first condition is true, the second condition must be judged;When the first condition
Transferred from: http://www.linuxidc.com/Linux/2011-05/35723.htmHere's how:(1) Enter the command:Nohup your shell Command &(2) Enter the terminal back to the shell command line;(3) Enter the Exit command to exit the terminal:Exit(4) You can now
To implement a shell interpreter of its own, the principle is relatively simple, first get the user's input, through the fork () function to get two processes (parent-child process), the child process through the EXECVP () function continues, at
After adding some interceptor code, the CPU alarm shows that CPU utilization exceeds 100%.To find out exactly what code consumes too much resources, find a blog post from the Web, reproduced as follows:http://blog.csdn.net/guixunlong/article/details/
ArrayWhat array?An array is a collection that stores multiple storage units together continuously. In Linux, every storage unit in an array is called an array element. By default, the variable type of each array element is character. Therefore,
Parallelize)
// Load data 1 ~ 10
Val num = SC. parallelize (1 to 10)
// Multiply each data item by 2. Note that _ * 2 is recorded as a function (fun)
Val doublenum = num. Map (_ * 2)
// Memory cache data
Doublenum. cache ()
// Filter data.
In the shell script, ECHO Displays the content in color, and ECHO Displays the content in color. You need to use the-e parameter.The format is as follows:Echo-e "\ 033 [background color; text color M string \ 033 [0 m"For example:Echo-e "\ 033 [41; 3
I wrote a shell script to maintain the test environment, used crontab Scheduling for scheduled execution, and encountered a garbled problem. The script runs directly in the shell environment without any questions.
The conclusion is that crontab
1. Event Description:
1 ,#! /Bin/bash
Cat ../ip.txt | while read line
Do
Echo $ line
SSH $ line "ls"
Done
The result is recycled once and then exited. The reason is that while uses the redirection mechanism. All the information in the file is read
[Copyright statement: reprinted. Please retain the Source: blog.csdn.net/gentleliu. Mail: shallnew at 163 dot com]
The grep command is used to obtain the line information that complies with the rules. This section describes how to use awk to obtain
Tag: Shell
Before talking about [email protected] and $ *, you need to start with the positional parameter of shell script...We all know how variables are defined and replaced.However, we also need to know that some variables are set in shell, and
[Shell Study Notes] the sort and uniq commands sort the text, single and repeat the document directory [hide]
Sort command syntax
Common options
Common sort usage
Uniq command
Command Options
Uniq usage
Sort is a commonly
What is the difference between shell learning ?, Where does shell learn?Strictly speaking,
Because 0 is the default value of
> This method is used to export data to a file. If the file does not exist, the file is created. If the file exists,
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.