Sponsored Content
Full Discussion: looping and awk/sed help
Top Forums Shell Programming and Scripting looping and awk/sed help Post 76472 by Zelp on Tuesday 28th of June 2005 12:44:14 PM
Old 06-28-2005
I guess there is more explanation needed.
We have 25 DB's that have identical schema (the same table exists in all of them) but the data is different.

we are hoping to combine all of them into 1 DB, first I am trying to find all the differences between each table in each DB's to investigate them before we just put them all together.

so you see the template I have already contains all the connections in the SQLs, I just want to replace all the *'s and #'s and save that as a new sql named after the table all the sql's are for. So now the new sql created will select the same columns from the same tables in all 25 DB's for the comparison.

am I making any sense anymore?

maybe in the second portion instead of a print, I can do a replace of the table_names and column_names into a new file based on my template?
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Looping in awk

Can somebody give me a cleaner way of writing the following script. I was thinking that I could use a loop in the awk statement. It works fine the way it is but I just want the script to be cleaner. #!/usr/bin/sh for r in 0 1 2 3 4 5 6 do DAY=`gdate --date="${r} days ago" +%m\/%d\/%y`... (3 Replies)
Discussion started by: keelba
3 Replies

2. Shell Programming and Scripting

Awk: looping problem!

I am having a problem with awk when I run it with a loop. It works perfectly when I echo a single line from the commandline. For example: echo 'MFG009 9153852832' | awk '$2 ~ /^0-9]$/{print $2}' The Awk command above will print field 2 if field 2 matches 10 digits, but when I run the loop... (5 Replies)
Discussion started by: cstovall
5 Replies

3. Shell Programming and Scripting

Looping and using Sed

Hi guys I having som problem trying to use sed to get a file and insert inside another one. I'll try to explain better. I have a base.txt and using sed(having a array variables) I'm chaging some strings inside this file and saving as base1.txt. until here okay. Then, I have to get this... (4 Replies)
Discussion started by: digobh
4 Replies

4. UNIX for Dummies Questions & Answers

Help with AWK looping

I'm trying to parse a configuration text file using awk. The following is a sample from the file I'm searching. I can retrieve the formula and recipe names easily but now I want to take it one step farther. In addition to the formula name, I would like to also get the value of the attribute... (6 Replies)
Discussion started by: new2awk
6 Replies

5. Shell Programming and Scripting

Sed pattern space/looping conundrum

Although my sed skills are gradually developing, thanks in large part to this forum, I'm having a hard time dealing with pattern space and looping, which I suspect is what I'll need a better handle on to figure out my current issue, which is converting a multi line file like this: ... (4 Replies)
Discussion started by: tiggyboo
4 Replies

6. Shell Programming and Scripting

looping in awk

How do I remove last comma? echo "xx yy zz" | awk 'BEGIN{FS=" "}{for (i=1; i<=NF; i++) printf "%s,", $i}'output: xx,yy,zz, required output: xx,yy,zz or (ideally!): xx, yy & zz many thanks in advance! (4 Replies)
Discussion started by: euval
4 Replies

7. Shell Programming and Scripting

AWK looping over 2 variables

I would like to loop over variables i and j consecutively, { a = -6.7 b = 7.0 c =0.1 { for (i = 0; i<=(b-a)/c; i++) for (j = 1; j<=(b-a)/c; j++) '$1<=(a+j*c)&&$1>=(a+i*c)' FILENAME > output_j '{print $2}' output_j > output_j_f } I essentially want to print the range of $1... (9 Replies)
Discussion started by: chrisjorg
9 Replies

8. Shell Programming and Scripting

Help on looping using awk

I have the data like this: PONUMBER,SUPPLIER,LINEITEM,SPLITLINE,LINEAMOUNT,CURRENCY IR5555,Supplier1,1,1,83.1,USD IR5555,Supplier1,1,3,40.4,USD IR5555,Supplier1,1,6,54.1,USD IR5555,Supplier1,1,8,75.1,USD IR5556,Supplier2,1,1,41.1,USD IR5556,Supplier2,1,3,43.1,USD ... (3 Replies)
Discussion started by: jeffreybsu
3 Replies

9. UNIX for Beginners Questions & Answers

Looping and sed

Hi, I've got text files (say file1 and file2) in a directory (say directory1) with several columns like this: a b c d a b c de f g h e f g hI need to add a header to the files in directory1 and the names of the columns must contain an identifier from another text file (say file3) like this:... (4 Replies)
Discussion started by: zajtat
4 Replies

10. Shell Programming and Scripting

awk nested looping?

I am trying to parse a text file and send its output to another file but I am having trouble conceptualizing how I am supposed to do this in awk. The text file has a organization like so: Name Date Status Location (city, state, zip fields) Where each of these is on a separate line in... (1 Reply)
Discussion started by: kellyanneghj
1 Replies
DBICADMIN(1p)						User Contributed Perl Documentation					     DBICADMIN(1p)

NAME
dbicadmin - utility for administrating DBIx::Class schemata SYNOPSIS
dbicadmin: [-I] [long options...] deploy a schema to a database dbicadmin --schema=MyApp::Schema --connect='["dbi:SQLite:my.db", "", ""]' --deploy update an existing record dbicadmin --schema=MyApp::Schema --class=Employee --connect='["dbi:SQLite:my.db", "", ""]' --op=update --set='{ "name": "New_Employee" }' OPTIONS
Actions --create Create version diffs needs preversion --upgrade Upgrade the database to the current schema --install Install the schema version tables to an existing database --deploy Deploy the schema to the database --select Select data from the schema --insert Insert data into the schema --update Update data in the schema --delete Delete data from the schema --op compatiblity option all of the above can be suppied as --op=<action> --help display this help Arguments --schema-class The class of the schema to load --resultset or --resultset-class or --class The resultset to operate on for data manipulation --config-stanza Where in the config to find the connection_info, supply in form MyApp::Model::DB --config Supply the config file for parsing by Config::Any --connect-info Supply the connect info as additional options ie -I dsn=<dsn> user=<user> password=<pass> --connect Supply the connect info as a json string --sql-dir The directory where sql diffs will be created --sql-type The RDBMs flavour you wish to use --version Supply a version install --preversion The previous version to diff against --set JSON data used to perform data operations --attrs JSON string to be used for the second argument for search --where JSON string to be used for the where clause of search --force Be forceful with some operations --trace Turn on DBIx::Class trace output --quiet Be less verbose -I Same as perl's -I, prepended to current @INC AUTHORS
See "CONTRIBUTORS" in DBIx::Class LICENSE
You may distribute this code under the same terms as Perl itself perl v5.14.2 2011-11-29 DBICADMIN(1p)
All times are GMT -4. The time now is 10:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy