Sponsored Content
Top Forums Shell Programming and Scripting Help with approach and developing script Post 302941815 by nirasm on Tuesday 21st of April 2015 11:33:25 AM
Old 04-21-2015
Help with approach and developing script

Hi-
I need to develop a script for following scenario in AIX and K shell environment.I am from windows server background for most my career ,so please bear with me and advise suitable approach and technical assistance.Having said that I am aware of unix shell commands but never pput together at scripting level.

My scenario is::

step1)Extract data(I have a custom query that runs against a view) from postgreSQL database to a file called F1.I will need to use psql command line option.

step2)File F1 consists of 3 columns(C1,C2 and C3) and may contain any no of rows.(range between 1000-25,000).

Step2-A) Now I need run a external utility(u1.exe program) for each column C1 value in file F1 and write the output to another file F2.
Step2-B) F2 file should consist of only one column(i.e C1).Basically the values for C1 in F2 at this point is converted to a different value when run through utility u1.exe.

step3)Now,I need to pass each value in file F2 through another utility u2.exe that has specific argument. (This step sets some hold flag for me in the database for each corresponding value of F2).

step4)I need to run similar process as above(step3) but with a different set of argument (This step sets some delete flag for me in the database for each corresponding value in F2).

This ends my process.

Note:
->At each step,I am looking to have a verbose log file.
->Utility U1.exe and u2.exe are command line utilities from a different application
->C1 value is number type column

Kindly let me know if you need any clarifications.

Thanks,
Niras
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can you help me regarding developing script?

Hi All, I want to develope this script. any help will be appreciated. It is possible to use two pipes and create two-way communication between two processes. (In practice, this is not done because sockets are available.) Create a program where the parent process reads the name of a language... (2 Replies)
Discussion started by: vishalpatel03
2 Replies

2. Shell Programming and Scripting

Approach to writting a script

Hello all, I've just joined. I did a google search and your site came up, I had a look and thought I'd like to become a member. I'm from Ireland. I've written a few scripts before, but this new task has me foxed. I would like to figure out the best approach to achieving the following ... (15 Replies)
Discussion started by: Bloke
15 Replies

3. Shell Programming and Scripting

Developing own shell

Hi everyone.I am trying ti create my own shell in C.So far i have managed to create a parser to separate args from cmd line of my shell.(i have done nothing different for tokens is that wrong?).so i can run commands like "ls -l" "cp" "cat" etc.now i want to add redirection.can anyone guide me... (1 Reply)
Discussion started by: bashuser2
1 Replies

4. SuSE

Write shell script using menu-driven approach to show various system

QUESTION: Write shell script using menu-driven approach to show various system configuration like 1) Currently logged user and his logname 2) Your current shell 3) Your home directory 4) Your current path setting 5) Your current working directory 6) Show Currently logged number of... (1 Reply)
Discussion started by: bboyjervis
1 Replies

5. Shell Programming and Scripting

Help in developing an awk code

#!/bin/ksh set -x FILENAME=$1 #To calculate debit and credit DEBIT=`awk -F, '{value=$28 ;if(value<0) {debit+=value}} END {print debit}' $FILENAME` CREDIT=`awk -F, '{value=$28 ;if(value>0) {credit+=value}} END {print credit}' $FILENAME` #This part is not working since the debit value is... (2 Replies)
Discussion started by: selvankj
2 Replies

6. Shell Programming and Scripting

Need advice on approach for script

Greetings all. I have a repository server which receives, without exhaggeration, several million files a week. The majority of these files are in .csv format, which means they're highly compressable. They are spread throughout numerous directories where there are configured monitoring utilities... (4 Replies)
Discussion started by: msarro
4 Replies

7. UNIX for Dummies Questions & Answers

Help for developing script

I want to develop a unix script. Scenario:A folder is containing many text files and there is one text file eg. test.csv which is having 2 words at line 1 & line 2.The script should search for word at line 1 in test.csv file in all other text file present in folder & replace it with word at line 2... (5 Replies)
Discussion started by: Anna Cardoz
5 Replies

8. Red Hat

What would be the best approach?

I have a table in one of my DB. The DB is about 300 gig - of that 249 gig is in this table. The data is somewhat important but even if we delete half of it won't affect anybody. I would like to reclaim some space back so my question is what would be the best approach to accomplish this task.... (6 Replies)
Discussion started by: newborndba
6 Replies

9. UNIX for Beginners Questions & Answers

What is the right approach to take?

Hello every one, I will love to know what is the best approach to take in obtaining books online. I find it disturbing just googling a book online and downloading it without actually paying for it. I strongly believe that this is wrong and that i may not be able to unlock the key contents and... (2 Replies)
Discussion started by: despiragado
2 Replies

10. What is on Your Mind?

Developing Applications for UNIX.COM

A number of people have asked me about the best way to develop some cool new web app for UNIX.COM. In today's "very easy web dev" world, developers do not need to be burdened (like I am) to the "back end" of the site. The best way to develop web apps is to build the application on your desktop... (2 Replies)
Discussion started by: Neo
2 Replies
VACUUMDB(1)						  PostgreSQL Client Applications					       VACUUMDB(1)

NAME
vacuumdb - garbage-collect and analyze a PostgreSQL database SYNOPSIS
vacuumdb [ connection-option... ] [ [ --full ] [ -f ] ] [ [ --verbose ] [ -v ] ] [ [ --analyze ] [ -z ] ] [ [ --freeze ] [ -F ] ] [ --table | -t table [ ( column [,...] ) ] ] [ dbname ] vacuumdb [ connection-options... ] [ [ --all ] [ -a ] ] [ [ --full ] [ -f ] ] [ [ --verbose ] [ -v ] ] [ [ --analyze ] [ -z ] ] [ [ --freeze ] [ -F ] ] DESCRIPTION
vacuumdb is a utility for cleaning a PostgreSQL database. vacuumdb will also generate internal statistics used by the PostgreSQL query optimizer. vacuumdb is a wrapper around the SQL command VACUUM [vacuum(7)]. There is no effective difference between vacuuming databases via this utility and via other methods for accessing the server. OPTIONS
vacuumdb accepts the following command-line arguments: -a --all Vacuum all databases. [-d] dbname [--dbname] dbname Specifies the name of the database to be cleaned or analyzed. If this is not specified and -a (or --all) is not used, the database name is read from the environment variable PGDATABASE. If that is not set, the user name specified for the connection is used. -e --echo Echo the commands that vacuumdb generates and sends to the server. -f --full Perform ``full'' vacuuming. -q --quiet Do not display progress messages. -t table [ (column [,...]) ] --table table [ (column [,...]) ] Clean or analyze table only. Column names can be specified only in conjunction with the --analyze option. Tip: If you specify columns, you probably have to escape the parentheses from the shell. (See examples below.) -v --verbose Print detailed information during processing. -z --analyze Calculate statistics for use by the optimizer. -F --freeze Aggressively ``freeze'' tuples. vacuumdb also accepts the following command-line arguments for connection parameters: -h host --host host Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. -p port --port port Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. -U username --username username User name to connect as. -w --no-password Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. -W --password Force vacuumdb to prompt for a password before connecting to a database. This option is never essential, since vacuumdb will automatically prompt for a password if the server demands password authentica- tion. However, vacuumdb will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. ENVIRONMENT
PGDATABASE PGHOST PGPORT PGUSER Default connection parameters This utility, like most other PostgreSQL utilities, also uses the environment variables supported by libpq (see in the documentation). DIAGNOSTICS
In case of difficulty, see VACUUM [vacuum(7)] and psql(1) for discussions of potential problems and error messages. The database server must be running at the targeted host. Also, any default connection settings and environment variables used by the libpq front-end library will apply. NOTES
vacuumdb might need to connect several times to the PostgreSQL server, asking for a password each time. It is convenient to have a ~/.pgpass file in such cases. See in the documentation for more information. EXAMPLES
To clean the database test: $ vacuumdb test To clean and analyze for the optimizer a database named bigdb: $ vacuumdb --analyze bigdb To clean a single table foo in a database named xyzzy, and analyze a single column bar of the table for the optimizer: $ vacuumdb --analyze --verbose --table 'foo(bar)' xyzzy SEE ALSO
VACUUM [vacuum(7)] Application 2010-05-14 VACUUMDB(1)
All times are GMT -4. The time now is 11:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy