Sponsored Content
Full Discussion: awk command optimization
Top Forums Shell Programming and Scripting awk command optimization Post 302743723 by abhi1988sri on Thursday 13th of December 2012 07:11:11 AM
Old 12-13-2012
awk command optimization

Hi,

I need some help to optimize this piece of code:

Code:
 
sqlplus -S  $DB_USER/$DB_PWD@$DB_INSTANCE @$PRODUCT_COLL/$SSA_NAME/bin/tools/sql/tablespace.sql | grep -i UNDO_001_COD3 | awk '{printf "[""'${curr_date}'""];TBS_UNDO_001_COD3"$5"\n"}'
  sqlplus -S  $DB_USER/$DB_PWD@$DB_INSTANCE @$PRODUCT_COLL/$SSA_NAME/bin/tools/sql/tablespace.sql | grep -i SYSAUX | awk '{printf "[""'${curr_date}'""];TBS_SYSAUX"$5"\n"}'
  sqlplus -S  $DB_USER/$DB_PWD@$DB_INSTANCE @$PRODUCT_COLL/$SSA_NAME/bin/tools/sql/tablespace.sql | grep -i INDX_004_COD3 | awk '{printf "[""'${curr_date}'""];TBS_INDX_004_COD3"$5"\n"}'
  sqlplus -S  $DB_USER/$DB_PWD@$DB_INSTANCE @$PRODUCT_COLL/$SSA_NAME/bin/tools/sql/tablespace.sql | grep -i INDX_002_COD3 | awk '{printf "[""'${curr_date}'""];TBS_INDX_002_COD3"$5"\n"}'
  sqlplus -S  $DB_USER/$DB_PWD@$DB_INSTANCE @$PRODUCT_COLL/$SSA_NAME/bin/tools/sql/tablespace.sql | grep -i DATA_002_COD3 | awk '{printf "[""'${curr_date}'""];TBS_DATA_002_COD3"$5"\n"}'
  sqlplus -S  $DB_USER/$DB_PWD@$DB_INSTANCE @$PRODUCT_COLL/$SSA_NAME/bin/tools/sql/tablespace.sql | grep -i SYSTEM | awk '{printf "[""'${curr_date}'""];TBS_SYSTEM"$5"\n"}'
  sqlplus -S  $DB_USER/$DB_PWD@$DB_INSTANCE @$PRODUCT_COLL/$SSA_NAME/bin/tools/sql/tablespace.sql | grep -i DATA_003_COD3 | awk '{printf "[""'${curr_date}'""];TBS_DATA_003_COD3"$5"\n"}'
  sqlplus -S  $DB_USER/$DB_PWD@$DB_INSTANCE @$PRODUCT_COLL/$SSA_NAME/bin/tools/sql/tablespace.sql | grep -i INDX_003_COD3 | awk '{printf "[""'${curr_date}'""];TBS_INDX_003_COD3"$5"\n"}'
  sqlplus -S  $DB_USER/$DB_PWD@$DB_INSTANCE @$PRODUCT_COLL/$SSA_NAME/bin/tools/sql/tablespace.sql | grep -i DATA_004_COD3 | awk '{printf "[""'${curr_date}'""];TBS_DATA_004_COD3"$5"\n"}'
  sqlplus -S  $DB_USER/$DB_PWD@$DB_INSTANCE @$PRODUCT_COLL/$SSA_NAME/bin/tools/sql/tablespace.sql | grep -i DATA_001_COD3 | awk '{printf "[""'${curr_date}'""];TBS_DATA_001_COD3"$5"\n"}'
  sqlplus -S  $DB_USER/$DB_PWD@$DB_INSTANCE @$PRODUCT_COLL/$SSA_NAME/bin/tools/sql/tablespace.sql | grep -i PATROL_TBS | awk '{printf "[""'${curr_date}'""];TBS_PATROL_TBS"$5"\n"}'
  sqlplus -S  $DB_USER/$DB_PWD@$DB_INSTANCE @$PRODUCT_COLL/$SSA_NAME/bin/tools/sql/tablespace.sql | grep -i INDX_001_COD3 | awk '{printf "[""'${curr_date}'""];TBS_INDX_001_COD3"$5"\n"}'
  sqlplus -S  $DB_USER/$DB_PWD@$DB_INSTANCE @$PRODUCT_COLL/$SSA_NAME/bin/tools/sql/tablespace.sql | grep -i PRECISE_DATA | awk '{printf "[""'${curr_date}'""];TBS_PRECISE_DATA"$5"\n"}'
  sqlplus -S  $DB_USER/$DB_PWD@$DB_INSTANCE @$PRODUCT_COLL/$SSA_NAME/bin/tools/sql/tablespace.sql | grep -i SSITOOLS | awk '{printf "[""'${curr_date}'""];TBS_SSITOOLS"$5"\n"}'

I have to repeatedly run this command inside my script with different prints in grep.

Is there any way to do this in an optimised way , so that I donot have to run this command multiple times?

Thanks

Abhinav

Last edited by Scrutinizer; 12-13-2012 at 08:18 AM.. Reason: icode -> code tags
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

script optimization

:o Hi, I am writing a script in which at some time, I need to get the process id of a special process and kill it... I am getting the PID as follows... ps -ef | grep $PKMS/scripts | grep -v grep | awk '{print $2 }'can we optimize it more further since my script already doing lot of other... (3 Replies)
Discussion started by: vivek.gkp
3 Replies

2. Shell Programming and Scripting

AWK optimization

Hello, Do you have any tips on how to optimize the AWK that gets the lines in the log between these XML tags? se2|6|<ns1:accountInfoRequest xmlns:ns1="http://www.123.com/123/ se2|6|etc2"> .... <some other tags> se2|6|</ns1:acc se2|6|ountInfoRequest> The AWK I'm using to get this... (2 Replies)
Discussion started by: majormark
2 Replies

3. Shell Programming and Scripting

sed optimization

I have a process using the following series of sed commands that works pretty well. sed -e 1,1d $file |sed 1i\\"EHLO Broadridge.com" |sed 2i\\"MAIL FROM:${eaddr}"|sed 3i\\"RCPT TO:${eaddr}"|sed 4i\\"DATA"|sed 5s/.FROM/FROM:/|sed 6s/.TO/TO:/|sed 7,7d|sed s/.ENDDATA/./|sed s/.ENDARRAY// >temp/$file... (1 Reply)
Discussion started by: njaiswal
1 Replies

4. Shell Programming and Scripting

Awk script gsub optimization

I have created Shell script with below awk code for replacing special characters from input file. Source file has 6 mn records. This script was able to handle 2 mn records in 1 hr. This is very slow speed and we need to optimise our processing. Can any Guru help me for optimization... (6 Replies)
Discussion started by: Akshay
6 Replies

5. Shell Programming and Scripting

awk command in script gives error while same awk command at prompt runs fine: Why?

Hello all, Here is what my bash script does: sums number columns, saves the tot in new column, outputs if tot >= threshold val: > cat getnon0file.sh #!/bin/bash this="getnon0file.sh" USAGE=$this" InFile="xyz.38" Min="0.05" # awk '{sum=0; for(n=2; n<=NF; n++){sum+=$n};... (4 Replies)
Discussion started by: catalys
4 Replies

6. Shell Programming and Scripting

CPU optimization

hi guys , I have 10 scripts suppose 1.sh , 2.sh ,3.sh ,4.sh ......10.sh each takes some time ( for instance 2 minutes to 40 minutes ) my server can run around 3-4 files at a time suppose, 1.sh , 2.sh , 3.sh are running currently now as soon as ANY ONE of the gets finished i... (4 Replies)
Discussion started by: Gl@)!aTor
4 Replies

7. Shell Programming and Scripting

awk command optimization

gawk -v sw="error|fail|panic|accepted" 'NR>1 && NR <=128500 { for (w in a) { ... (15 Replies)
Discussion started by: SkySmart
15 Replies

8. Shell Programming and Scripting

Code optimization

Hi all I wrote below code: #!/bin/sh R='\033 do you have any idea how to optimize my code ? (to make it shorter eg.) (11 Replies)
Discussion started by: primo102
11 Replies

9. UNIX for Advanced & Expert Users

Need Optimization shell/awk script to aggreagte (sum) for all the columns of Huge data file

Optimization shell/awk script to aggregate (sum) for all the columns of Huge data file File delimiter "|" Need to have Sum of all columns, with column number : aggregation (summation) for each column File not having the header Like below - Column 1 "Total Column 2 : "Total ... ...... (2 Replies)
Discussion started by: kartikirans
2 Replies
DROP 
TABLESPACE(7) SQL Commands DROP TABLESPACE(7) NAME
DROP TABLESPACE - remove a tablespace SYNOPSIS
DROP TABLESPACE [ IF EXISTS ] tablespacename DESCRIPTION
DROP TABLESPACE removes a tablespace from the system. A tablespace can only be dropped by its owner or a superuser. The tablespace must be empty of all database objects before it can be dropped. It is possible that objects in other databases might still reside in the tablespace even if no objects in the current database are using the tablespace. Also, if the tablespace is listed in the temp_tablespaces setting of any active session, the DROP might fail due to temporary files residing in the tablespace. PARAMETERS
IF EXISTS Do not throw an error if the tablespace does not exist. A notice is issued in this case. tablespacename The name of a tablespace. NOTES
DROP TABLESPACE cannot be executed inside a transaction block. EXAMPLES
To remove tablespace mystuff from the system: DROP TABLESPACE mystuff; COMPATIBILITY
DROP TABLESPACE is a PostgreSQL extension. SEE ALSO
CREATE TABLESPACE [create_tablespace(7)], ALTER TABLESPACE [alter_tablespace(7)] SQL - Language Statements 2010-05-14 DROP TABLESPACE(7)
All times are GMT -4. The time now is 06:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy