In the process of software development, it often involves changing the database script file from sh format to SQL format in Linux. This document uses an actual script file as an example to describe
In the process of software development, it often involves changing the database scri
In Linux, how does one change the database script file from the sh format to the SQL format,
In the process of software development, it often involves changing the database script file from sh format to SQL format in Linux. This d
1. sh File contents
The file name in this article is example.sh, which reads as follows:
#!/bin/bash
function Init ()
{
If [-F "Example.sql"]
Then
echo "Example.sql is exits and is deleting it,then recreate it"
Rm-fexample.sql
Else
echo "Example.sql no exits and is creating it"
Fi
echo "usezxdbp_166" >>example.sql
echo "Go" >>example.sql
}
function CreateTable ()
{
cat>>example.sql
CREATE TABLE Tb_employeeinfo
(
Employeeno varchar NOT NULL--employee work number
EmployeeName
Shell script programming (strict terminal format control, beautiful output font color), shell script Programming
#! /Bin/bash # font output color and terminal format control # font color 30-37echo-e "\ 033 [30 m black character \ 033 [0 m" echo-e "\ 033 [31 m red word \ 033 [0 m "echo-e" \ 033 [32 m green word \ 033 [0
Python timer usage + get script where absolute path + define log format test codeIf you write a script with a timer in Python, if the script also read the configuration file, then the configuration file path if you write to die, one day to change the directory, you need to change the
configuration files and function scripts, such as source conf/httpd.conf3) The main script process only implements the program backbone, the function implementation as far as possible encapsulated in the child function. 4) for scripts that can be executed independently , use the usage and version functions, and you can output usages and versioning information. 5) canonical code tree. function specification1) The function definition is preceded by
In the process of software development, it often involves the problem of changing the database script file from SH format to SQL format under Linux. This article takes an actual script file as an example to illustrate the process of format conversion.1. sh File contentsThe f
control (%), format-string can be reused and all parameters can be converted.
Arguments use spaces separated by commas.
Take a look at the following example:
# format-string is double quotes
$ printf "%d%s\ n" 1 "abc"
1 ABC
# single quotes are the same as double quotes
$ printf '%d%s\ n' 1 "abc"
1 ABC
# No quotation marks can also be output
$ printf %s abcdef
ABCdef
physical operations on the database, so that the database may be suspended.RMAN> configure controlfile autobackup format for device type disk to '% F'; k to' % F'; Note: physical operation backup to diskRun {Allocate channel c1 type sbt_tape; back up the control file to the warehouse.Backup database;}If automatic backup of the control file is enabled in rman, it is still the backup script. After archiving
The following small series will bring you a python script to export data in Excel format (recommended ). I think this is quite good. now I will share it with you and give you a reference. Let's take a look at the small Editor. during my internship, a server engineer asked me to help sort out the server's log data. Finally, I used Python to extract the data and export it in Excel
There are many examples of shell script-reading text files on the web, but they don't tell the whole story, only half of it. For example, read a text line from a testfile file in the following format:
Copy Code code as follows:
$ VI testfile
Ls-a-l/bin | Sort
Ls-a-l/bin | Sort | Wc
Ls-a-L | grep sh | Wc
Ls-a-L
Ls-a-L | Sort | Wc
One of the most common examples of line by line
When writing a reconstruction algorithm, it is necessary to use the point coordinate and the normal data file, and then use the normal calculation module in the PCL to generate the normal direction. The post-output method contains curvature information in the file, but this is not required. Then wrote a Python small script to implement the format conversion.#--coding:utf-8--Import TimeImportNumPy as NP from
Python script to export data in excel format (recommended), python data export
During my internship, a senior engineer from the server asked me to help sort out the server's log data. Finally, I used Python to extract the data and export it in Excel format.The following is the source code implemented by Python,You can automatically traverse all text files in a file directory, export the total data to an Exc
Problem Description:In a index.html Web page, a jquery script was introduced, but an error occurred, prompting $ is not defined Window.onload=function () {Console.log ($); //$ is not defined }In the console, it is found that jquery returns a garbled format, so the above error occurs.Under normal circumstances, this should be the case:The cause of this error is the encoding of the file, in Notepad open
Again to the Comiket tide, grabbed down the name of the file is always the format is not uniform, sorted by file name is not convenient to view. So it's time to go Ruby again.
(Every time I go to the batch rename file, my first reaction is to open IRB ...) )
The script is available in several categories of directories, so take a note.
Scripting: Adjusts the space in the first part of the file name of a s
The bash script under Linux does not support line breaks \r , and if you run a file that is copied from Windows, you /bin/bash^M: 坏的解释器: 没有那个文件或目录 may want to check if the file format is incorrect.If this is a format problem, there are two ways:First, find the replacement method
First step: cat -A filename view ' \ 及 r \ 空白符, n \ 会显示为 r \ ,而 会显示为 ^m '.
S
There are several special variables in shell scripts, which sometimes play a major role. Let's repeat them tonight and make a small summary.
These special variables are:
$ @ All variables are treated as a string$ * Each is an independent string.$ # Reference the number of parameters passed to the script through the command line$0 script name itself$ Process ID of the current command$ _ Display result of exe
the same directory.
If you want to be convenient, you can build a. bat file in the form of a command line, you can do all the work automatically with a single click, as follows:
EchoPython test.py
My own implementation is about 150M files run a minute and a half of the time out of the results, I think it is more ideal.
Above this Python script implementation of data export Excel format simple method (recom
, which is the data source for the Pnp4nagios performance graph plug-in, and the output format for that data is:Detection Item name (usually abbreviated) = the current detection value (can be carried units); Warning value; Critical value, minimum value of detection item, maximum value of detection itemThe above value cannot be left blank if it is not.Example:DISK ok-free Space:/Home 3326 MB (56%); |/home=2643mb;5948;5958;0;5968Status Description infor
Project path: Https://code.csdn.net/langresser/excel2jsonA python script that automatically transforms the configuration in Excel into JSON format.1. This is for unity, but a little modification can be run in any environment2, Excel content requirements for the form of key-value pairs, specifically, you can refer to the instructions in the script.3, read the code
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.