A database adds a large amount of random data (shell scripts)

Source: Internet
Author: User

During this period of time, I was engaged in big data research. Where should I find a large amount of data? Well, some automatic generation tools on the Internet do not meet my own needs, so I wrote one myself, A script that can generate a large amount of random data and configure the configuration file. Although the configuration file is not flexible enough in some places, the basic requirements are also OK.

NextSource codePost it and share it.

There are two files

Config. h

 
Hostname = '10. 33.28.231 'port = '000000' username = "drmtest" passwd = "test" dbname = "test" tablename = "testdb" # This value has two place usedtable_attr = (INT varchar); # The type of column for tablename; # mysql_ SQL = "select * from $ {tablename}" mysql_ SQL = "$ {1 }"; mysql-h $ {hostname}-p $ {port}-U $ {username}-p $ {passwd }$ {dbname}-e "$ {mysql_ SQL }";

Inservalue. Sh

Video: amazing young man of the year: "Wild Youth" http://v.youku.com/v_show/id_xndkxoda0mte2.htmlvideo: we must find things that allow us to stand strong with our feet apart from love. Http://v.youku.com/v_show/id_XNDA2ODE4NTgw.htmlRECORD_NUM=100CHAR_MAX_LEN=20TABLE_ATTR= (INT varchar) clo_num = 3cur_attr = 0 tablename = "testdb" function search () {local var; var =$ {! #} Local I; for I in $ * do if [$ Var = $ I]; then return 3 fi done} awk 'in in {record_num = int ("'$ record_num'"); max_len = int ("'$ char_max_len'"); print "awk begin "; srand (); Info = "a B c d e f g h I j k l m n o p q r s t u v w x y z"; split (info, arr, FS); # For (I = 0; I <26; I ++) # printf ("I = % d, % s", I, arr [I]); for (I = 0; I <record_num; I ++) {printf ("% d", 1024 * rand ()> "'$ 1'"; W = max_len * rand (); W = int (w) + 1; STR = ""; for (j = 0; j <W; j ++) {k = 100 * rand () % 26; k = int (k); STR = Str "" arr [k + 1];} printf ("% s", STR)> "'$ 1'"; W = 10 * rand (); W = int (w) + 1; STR = ""; for (j = 0; j <W; j ++) {k = 100 * rand () % 26; k = int (k ); STR = Str "" arr [k + 1];} printf ("% s", STR)> "'$1 '"; print ""> "'$ 1'" }}{ print "in awk ";} end {print "awk end"} '$ 1awk' begin {# SQL = "Sh config" # System (VAR );} {SQL = "Sh config" SQL _value = "("; for (I = 1; I <= 3; I ++) {if ($ I = int ($ I) SQL _value = SQL _value "" $ I; else {SQL _value = SQL _value """, "'\'' "SQL _value = SQL _value" "$ I SQL _value = SQL _value" "' \'' "} SQL _value = SQL _value """)"; print SQL _value; real_ SQL = "\" insert into "'$ {tablename}' (ID, name, passwd) values "real_ SQL = real_ SQL" "SQL _value" "\" "; print real_ SQL; SQL = SQL" "real_ SQL; System (SQL);} end {} '$1

Run the following command on the terminal:
$ Sh inservalue. Sh TMP

Related Article

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.