Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Using bash script : How to Import data from a dsv file into multiple tables in mysql Post 303030994 by tera on Wednesday 20th of February 2019 10:10:29 AM
Old 02-20-2019
Quote:
Originally Posted by steveo314
Do you have any experience with Perl?
Thank you for your response , no steve I don't have any experience there . Perhaps a perl script could also help because I'm looking to have reusable script .
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Import data from compressed file

HI I need to import data from a file which is in comressed format but system doesn't have enough space to uncompress file Is there any way so that i can do import from compressed file. (4 Replies)
Discussion started by: ap_gore79
4 Replies

2. Shell Programming and Scripting

Converting tables of row data into columns of tables

I am trying to transpose tables listed in the format into format. Any help would be greatly appreciated. Input: test_data_1 1 2 90% 4 3 91% 5 4 90% 6 5 90% 9 6 90% test_data_2 3 5 92% 5 4 92% 7 3 93% 9 2 92% 1 1 92% ... Output:... (7 Replies)
Discussion started by: justthisguy
7 Replies

3. Shell Programming and Scripting

Data Import perl script

Hi, I have a requirement for creating a Perl Script which will perform Data Import process in an automated way and I am elaborating herewith : Section 1 ) - use the following command line format : "./import.pl -h hostname -p port -f datafile.txt" Section 2) datafile.txt will... (3 Replies)
Discussion started by: scott_apc
3 Replies

4. Shell Programming and Scripting

Reading data from multiple tables from Oracle DB

Hi , I want to read the data from 9 tables in oracle DB into 9 different files in the same connection instance (session). I am able to get data from one table to one file with below code : X=`sqlplus -s user/pwd@DB <<eof select col1 from table1; EXIT; eof` echo $X>myfile Can anyone... (2 Replies)
Discussion started by: net
2 Replies

5. Shell Programming and Scripting

Shell snip to import CSV data into BASH array

I have been trying to write a simple snip of bash shell code to import from 1 to 100 records into a BASH array. I have a CSV file that is structured like: record1,item1,item2,item3,item4,etc.,etc. .... (<= 100 items) record2,item1,item2,item3,item4,etc.,etc. .... (<= 100 items)... (5 Replies)
Discussion started by: dstrout
5 Replies

6. Web Development

mysql query for multiple columns from multiple tables in a DB

Say I have two tables like below.. status HId sName dName StartTime EndTime 1 E E 9:10 10:10 2 E F 9:15 10:15 3 G H 9:17 10:00 logic Id devName capacity free Line 1 E 123 34 1 2 E 345 ... (3 Replies)
Discussion started by: ilan
3 Replies

7. Shell Programming and Scripting

Bash script with python slicing on multiple data files

I have 2 files generated in linux that has common output and were produced across multiple hosts with the same setup/configs. These files do some simple reporting on resource allocation and user sessions. So, essentially, say, 10 hosts, with the same (2) system reporting in the files, so a... (0 Replies)
Discussion started by: jdubbz
0 Replies

8. Shell Programming and Scripting

Append data by looking up 2 tables for multiple files

I want to lookup values from two different tables based on common columns and append. The trick is the column to be looked up is not fixed and varies , so it has to be detected from the header. How can I achieve this at once, for multiple data files, but lookup tables fixed. The two lookup... (5 Replies)
Discussion started by: ritakadm
5 Replies

9. Shell Programming and Scripting

In PErl script: need to read the data one file and generate multiple files based on the data

We have the data looks like below in a log file. I want to generat files based on the string between two hash(#) symbol like below Source: #ext1#test1.tale2 drop #ext1#test11.tale21 drop #ext1#test123.tale21 drop #ext2#test1.tale21 drop #ext2#test12.tale21 drop #ext3#test11.tale21 drop... (5 Replies)
Discussion started by: Sanjeev G
5 Replies

10. Shell Programming and Scripting

Shell script automation using cron which query's MySQL Tables

What I have: I have a input.sh (script which basically connect to mysql-db and query's multiple tables to write back the output to output1.out file in a directory) note: I need to pass an integer (unique_id = anything b/w 1- 1000) next to the script everytime I run the script which generates... (3 Replies)
Discussion started by: kkpand
3 Replies
DS(3)                                                      DACS Library Functions Manual                                                     DS(3)

NAME
ds - Dynamic strings and vectors SYNOPSIS
#include "dsslib.h" Ds *ds_init(Ds *ods); Ds *ds_init_size(Ds *ods, size_t nbytes); Ds *ds_alloc(void); Ds *ds_alloc_size(size_t nbytes); Ds *ds_reinit(Ds *ds); Ds *ds_reinit_size(Ds *ods, size_t nbytes); Ds *ds_reset(Ds *ds); Ds *ds_reset_buf(Ds *ds); Ds *ds_trim(Ds *ds); Ds *ds_grow(Ds *ds); void ds_free(Ds *ds); int ds_appendc(Ds *ds, int ch); int ds_copyb(Ds *ds, void *src, size_t len, unsigned int offset); int ds_insertb(Ds *ds, void *src, size_t len, unsigned int offset); int ds_append(Ds *ds, char *str); int ds_concat(Ds *ds, char *str); int ds_concatc(Ds *ds, int ch); int ds_concatn(Ds *ds, char *str, size_t len); Ds *ds_set(Ds *ds, char *str); Ds *ds_setn(Ds *ds, unsigned char *s, size_t slen); Ds *ds_range(Ds *ds, char *str, char *range_spec, Range_syntax *ors); int ds_getc(Ds *ds, FILE *fp, int *ch_ptr); Dsio *dsio_set(Ds *ds, FILE *fp, char *buf, unsigned long len, int have_length); int dsio_free(Ds *ds); int dsio_eof(Ds *ds); int dsio_nextc(Ds *ds, int *ch_ptr); int dsio_peekc(Ds *ds, int *ch_ptr); char *dsio_agets(Ds *ds); char *dsio_gets(Ds *ds); int dsio_load(Ds *ds); char *dsio_load_str(Ds *ds); char *ds_gets(Ds *ds, FILE *fp); char *ds_agets(Ds *ds, FILE *fp); char *ds_agets_buf(Ds *ds, char *buf); char *ds_prompt(Ds *ds, char *prompt, unsigned int flag); char *ds_readline(Ds *ds, char *prompt, char *cprompt); Ds *ds_load_file(Ds *ds, char *pathname); Ds *ds_agetf(Ds *ds, FILE *fp); Ds *ds_getf(FILE *fp); int ds_sprintf(Ds *ds, unsigned int offset, char *fmt, ...); int ds_asprintf(Ds *ds, char *fmt, ...); int ds_vasprintf(Ds *ds, char *fmt, va_list ap); char *ds_xprintf(char *fmt, ...); char *ds_vxprintf(char *fmt, va_list ap); FILE *ds_fopen_secure(const char *path, const char *mode, size_t size); int ds_fclose(FILE *fp); int ds_fclean(FILE *fp); Dsvec *dsvec_init(Dsvec *dsv, size_t size); Dsvec *dsvec_alloc(size_t size); Dsvec *dsvec_init_size(Dsvec *dsv, size_t size, int n); Dsvec *dsvec_alloc_size(size_t size, int n); void dsvec_free(Dsvec *dsv); Dsvec *dsvec_grow(Dsvec *dsv, unsigned int new_nelements); Dsvec *dsvec_subset(Dsvec *dsv, Dsvec *old_dsv, unsigned int start, int len); Dsvec *dsvec_copy(Dsvec *dsv, Dsvec *old_dsv); void *dsvec_ptr_index(Dsvec *dsv, unsigned int ind); int dsvec_delete_ptr_index(Dsvec *dsv, unsigned int ind); int dsvec_delete_ptr(Dsvec *dsv, void *ptr); int dsvec_replace_ptr(Dsvec *dsv, void *ptr, unsigned int ind); int dsvec_streq(Dsvec *dsv1, Dsvec *dsv2); int dsvec_strneq(Dsvec *dsv1, Dsvec *dsv2, size_t len); int dsvec_rotate(Dsvec *dsv, int npos); Dsvec *dsvec_strlist(Dsvec *dsv, char *str_spec); Dsvec *dsvec_slice(Dsvec *dsv, Dsvec *primary, unsigned int ind, unsigned int len); Dsvec *dsvec_range(Dsvec *dsv, Dsvec *primary, char *range_spec, Range_syntax *ors); int dsvec_replace(Dsvec *primary, unsigned int ind, unsigned int delete_len, Dsvec *secondary); int dsvec_append(Dsvec *primary, Dsvec *secondary); int dsvec_insert_ptr(Dsvec *dsv, unsigned int ind, void *ptr); int dsvec_add_ptr(Dsvec *dsv, void *ptr); int dsvec_insert(Dsvec *primary, unsigned int ind, Dsvec *secondary); int dsvec_delete(Dsvec *dsv, unsigned int ind, unsigned int ndelete); int dsvec_add_obj(Dsvec *dsv); void dsvec_sort(Dsvec *dsv, int (*compar)(const void *, const void *)); Dsvec *dsvec_load(Ds *ds, Dsvec *dsv); Dsvec *ds_mkargv_add(Dsvec *dsv, char *el); Dsvec *ds_mkargv_addv(Dsvec *dsv, int argc, char **argv); typedef struct Mkargv { int keepq; int keepws; char *ifs; char *startq; char *endq; } Mkargv; Dsvec *ds_mkargv(Dsvec *dsv, char *str, Mkargv *conf); char *ds_buf(Ds *ds); size_t ds_len(Ds *ds); size_t ds_size(Ds *ds); int ds_eq(Ds *ds1, Ds *ds2); (TYPE) dsvec_ptr(Ds *DSV, unsigned int IND, TYPE); (TYPE) dsvec_obj(Ds *DSV, unsigned int IND, TYPE); (TYPE) dsvec_new_obj(Ds *DSV, TYPE); (TYPE) dsvec_base_type(Ds *DSV, TYPE); void **dsvec_base(Dsvec *dsv); unsigned int dsvec_len(Dsvec *dsv); extern int ds_default_clear_flag; extern int ds_default_delnl_flag; extern size_t ds_default_len_limit; extern void *(*ds_default_malloc_func)(size_t size); extern void *(*ds_default_free_func)(void *ptr); DESCRIPTION
The DS library is a collection of functions for creating, manipulating, and formatting strings of bytes. The memory used by these strings is dynamically allocated and released as necessary. When used correctly, bugs caused by buffer overruns and other programming errors can be avoided. There are also functions for creating and manipulating dynamic vectors of pointers and objects. Byte Strings A Ds data structure represents a dynamic string. It must be initialized before it can be used. A Ds variable contains several fields that may be set after initialization but before it is first used. Default values for some of these fields are copied from global variables exported by the library. Initialization Manipulation Formatting Vectors DACS 1.4.27b 10/22/2012 DS(3)
All times are GMT -4. The time now is 04:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy