Sponsored Content
Full Discussion: looping and awk/sed help
Top Forums Shell Programming and Scripting looping and awk/sed help Post 76464 by Zelp on Tuesday 28th of June 2005 12:01:11 PM
Old 06-28-2005
okay that gets the output I need, but I am not sure how to use it the way I need to.

I have a template file I created that contains the sql statements and placeholders for columns_names and table_names

select * from #@connection1
minus
select * from #@connection2;

select * from #@connection1
minus
select * from #@connection3;
...etc for 25 diff DB's

i want to insert the column_name list for all the *'s in the file
and I want to replace the table_name for all the #'s in the file

then I want to save 1 set of sql's for each table so I can run them and create a log of any diffs form all DB's

sorry for so many questions, I am still very new to awk/sed wasn't sure which to use or how, thanks so much.
Zelp
 

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
DBIx::Class::Admin(3pm) 				User Contributed Perl Documentation				   DBIx::Class::Admin(3pm)

NAME
DBIx::Class::Admin - Administration object for schemas SYNOPSIS
$ dbicadmin --help $ dbicadmin --schema=MyApp::Schema --connect='["dbi:SQLite:my.db", "", ""]' --deploy $ dbicadmin --schema=MyApp::Schema --class=Employee --connect='["dbi:SQLite:my.db", "", ""]' --op=update --set='{ "name": "New_Employee" }' use DBIx::Class::Admin; # ddl manipulation my $admin = DBIx::Class::Admin->new( schema_class=> 'MY::Schema', sql_dir=> $sql_dir, connect_info => { dsn => $dsn, user => $user, password => $pass }, ); # create SQLite sql $admin->create('SQLite'); # create SQL diff for an upgrade $admin->create('SQLite', {} , "1.0"); # upgrade a database $admin->upgrade(); # install a version for an unversioned schema $admin->install("3.0"); REQUIREMENTS
The Admin interface has additional requirements not currently part of DBIx::Class. See DBIx::Class::Optional::Dependencies for more details. ATTRIBUTES
schema_class the class of the schema to load schema A pre-connected schema object can be provided for manipulation resultset a resultset from the schema to operate on where a hash ref or json string to be used for identifying data to manipulate set a hash ref or json string to be used for inserting or updating data attrs a hash ref or json string to be used for passing additional info to the ->search call connect_info connect_info the arguments to provide to the connect call of the schema_class config_file config_file provide a config_file to read connect_info from, if this is provided config_stanze should also be provided to locate where the connect_info is in the config The config file should be in a format readable by Config::General config_stanza config_stanza for use with config_file should be a '::' delimited 'path' to the connection information designed for use with catalyst config files config Instead of loading from a file the configuration can be provided directly as a hash ref. Please note config_stanza will still be required. sql_dir The location where sql ddl files should be created or found for an upgrade. sql_type The type of sql dialect to use for creating sql files from schema version Used for install, the version which will be 'installed' in the schema preversion Previous version of the schema to create an upgrade diff for, the full sql for that version of the sql must be in the sql_dir force Try and force certain operations. quiet Be less verbose about actions trace Toggle DBIx::Class debug output METHODS
create Arguments: $sqlt_type, \%sqlt_args, $preversion "create" will generate sql for the supplied schema_class in sql_dir. The flavour of sql to generate can be controlled by supplying a sqlt_type which should be a SQL::Translator name. Arguments for SQL::Translator can be supplied in the sqlt_args hashref. Optional preversion can be supplied to generate a diff to be used by upgrade. upgrade Arguments: <none> upgrade will attempt to upgrade the connected database to the same version as the schema_class. MAKE SURE YOU BACKUP YOUR DB FIRST install Arguments: $version install is here to help when you want to move to DBIx::Class::Schema::Versioned and have an existing database. install will take a version and add the version tracking tables and 'install' the version. No further ddl modification takes place. Setting the force attribute to a true value will allow overriding of already versioned databases. deploy Arguments: $args deploy will create the schema at the connected database. $args are passed straight to "deploy" in DBIx::Class::Schema. insert Arguments: $rs, $set insert takes the name of a resultset from the schema_class and a hashref of data to insert into that resultset update Arguments: $rs, $set, $where update takes the name of a resultset from the schema_class, a hashref of data to update and a where hash used to form the search for the rows to update. delete Arguments: $rs, $where, $attrs delete takes the name of a resultset from the schema_class, a where hashref and a attrs to pass to ->search. The found data is deleted and cannot be recovered. select Arguments: $rs, $where, $attrs select takes the name of a resultset from the schema_class, a where hashref and a attrs to pass to ->search. The found data is returned in a array ref where the first row will be the columns list. AUTHOR
See "CONTRIBUTORS" in DBIx::Class. LICENSE
You may distribute this code under the same terms as Perl itself perl v5.14.2 2011-05-10 DBIx::Class::Admin(3pm)
All times are GMT -4. The time now is 03:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy