Sponsored Content
Top Forums Shell Programming and Scripting Execution Problem with awk command Post 302949027 by Shilpi Gupta on Monday 6th of July 2015 08:30:40 AM
Old 07-06-2015
Execution Problem with awk command

Hi All,

I am trying to find a word from a file in loop.

Code:
  
 while read i; do
  DB_Name=$i
  awk '{for(i=1;i<=NF;i++)if($i~/$DB_Name/)print $(i)}' $BTEQ_NAME > $DB_Name_TableList.txt
  done <Param.txt

here Param.txt contents data as
Code:
  
 ODS_TARGT_RECV
FIN_TARGT
ODS_TARGT
ODS_REP
ODS_REP_SRCE
ODS_ARCV
EDW_TARGT
EDW_REP
EDW_DATA
EDW_REP_SRCE
edw_etl_target
edw_archive
WEB_TARGT
edw_archive
WEB_DRG1_APP_SRCE

And $BTEQ_NAME is passed as BTQ_OAP_700_dI_OSTG_AP_INVC_FS.sh, In the main body.

Code:
  
 #Script Name : DB_Validation.sh
#Author : Shilpi Gupta
 clear
 DB_FIND()
 {
  IFS=$'\n' 
  set -f
  echo "=================$BTEQ_NAME=================="
  while read i; do
  DB_Name=$i
  awk '{for(i=1;i<=NF;i++)if($i~/$DB_Name/)print $(i)}' $BTEQ_NAME > $DB_Name_TableList.txt
  done <Param.txt
 
  
}
  
 # Main Body of this Script
 BTEQ_NAME_LIST=$1
BTEQ_PARAM_FILE=$2
 awk '{for(i=1;i<=NF;i++)if($i~/\=/)print $(i)}' $BTEQ_PARAM_FILE|cut -d"=" -f1 > ParamP1.txt
 awk '{for(i=1;i<=NF;i++)if($i~/_/)print $(i)}' ParamP1.txt > Param.txt
 rm ParamP1.txt
 awk '{for(i=1;i<=NF;i++)if($i~/\=/)print $(i)}' $BTEQ_PARAM_FILE|cut -d"=" -f2 > ParamVal1.txt
 awk '{for(i=1;i<=NF;i++)if($i~/_/)print $(i)}' ParamVal1.txt > ParamVal.txt
 rm ParamVal1.txt
 for i in `cat ${BTEQ_NAME_LIST}` ; do
BTEQ_NAME=`echo "${i}" | awk -F"|" '{ print $1 }'`;
export BTEQ_NAME;
 DB_FIND
done


But while executing the script getting error as:
Code:
  
 awk: can't open BTQ_OAP_700_dI_OSTG_AP_INVC_FS.sh
 :
 :

Please let me Know where I am doing wrong...

Thanks,

Shilpi Gupta

Last edited by vbe; 07-06-2015 at 09:51 AM.. Reason: extra code tags...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

problem in awk command

Hello all, i am new one to this forum. : i have file with these contents.. internal://project/squid-internal-static/icons/anthony-xpm.gif http://widget.blogrush.com/img/br.png http://www.wingware.com/css/print http://publib.boulder.ibm.com/infocenter/systems/advanced/filterwarning.css... (3 Replies)
Discussion started by: viveksnv
3 Replies

2. Shell Programming and Scripting

Execution of awk command in a variable

Hi All, I have a awk command that is stored in a variable. the value of the variable cmd is: (mean output of echo $cmd is: ) awk -F";" '{print $1}' Now I want to execute this command. How can I do that???? Quick Reply will be appreciated. Regards, Amit (2 Replies)
Discussion started by: patelamit009
2 Replies

3. Post Here to Contact Site Administrators and Moderators

AWK command problem

How can I write an AWK so it could print some fixed strings and concatenate that with other words from an input file. Also having a string like "go" in the next line in the output file as below: Example: A fixed string like: "Hello my" and the input file is: friend mother father... (4 Replies)
Discussion started by: sybase08
4 Replies

4. Shell Programming and Scripting

Execution problems using awk command.

Hi All, I have the following requirement. In a directory i get files from external source. I at regular intervals check that directory for any incoming files. The file name is underscore delimited. Such as: aaa_bbb_ccc_ddd_eee_fff.dat I am using awk and and splitting the file name. ... (4 Replies)
Discussion started by: satishpv_2002
4 Replies

5. Shell Programming and Scripting

problem with awk command

I am having problem running an awk commad on a file Before applying awk command on the file After applying I don't expect more than 409743 records in the file. Why do I have 1 record more after applying awk command? Please let me know (4 Replies)
Discussion started by: dsravan
4 Replies

6. Shell Programming and Scripting

problem with awk command

I have written some code in a KSH script to find the index of the character in a string like this #!usr/bin/ksh string="Hi How are you" awk 'BEGIN {print index ($string, "are")}' My expected output should be : 8 but it is giving the out put as : 0 I wanted to store that index value in... (8 Replies)
Discussion started by: hemanth424
8 Replies

7. Shell Programming and Scripting

getting problem in awk command

Hi, I have one file with tab delimited values in it. i want to increase the value of 6th field by 2 if value of 3rd field is greater than 2 . The command is working fine but space between the field is getting removed after adding. below is the file and the command Filename: test1.txt ... (13 Replies)
Discussion started by: ravi_agarwalla
13 Replies

8. Linux

Execution problem wid mpstat command

mpstat -P ALL 1 10 it results.. 08:05:54 PM CPU %user %nice %sys %iowait %irq %soft %steal %idle intr/s 08:05:55 PM all 0.00 0.00 0.49 0.00 0.49 0.00 0.00 99.02 1024.75 08:05:55 PM 0 0.00 0.00 0.00 0.00 0.99 0.00 0.00 ... (1 Reply)
Discussion started by: pritesh_patil
1 Replies

9. Shell Programming and Scripting

Multiple command execution inside awk command during xml parsing

below is the output xml string from some other command and i will be parsing it using awk cat /tmp/alerts.xml <Alert id="10102" name="APP-DS-ds_ha-140018-componentFailure-S" alertDefinitionId="13982" resourceId="11427" ctime="1359453507621" fixed="false" reason="If Event/Log Level(ANY) and... (2 Replies)
Discussion started by: vivek d r
2 Replies

10. Shell Programming and Scripting

awk execution problem in csh

This has no error awk '($8==150) && ($4>=11.001 && $4 <= 12) && ($5>=91.001 && $5<=92){print}' OFS="\t" file following are unable to run in csh this is giving error awk: line 1: syntax error at or near not even working in terminal awk '($'$gr'=='$grn') && ($'$ll'>='$Y' && $'$ll' <= '$Ym')... (1 Reply)
Discussion started by: nex_asp
1 Replies
PAPS(1) 						      General Commands Manual							   PAPS(1)

NAME
paps - UTF-8 to PostScript converter using Pango SYNOPSIS
paps [options] files... DESCRIPTION
paps reads a UTF-8 encoded file and generates a PostScript language rendering of the file. The rendering is done by creating outline curves through the pango ft2 backend. OPTIONS
These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. --landscape Landscape output. Default is portrait. --columns=cl Number of columns output. Default is 1. --font=desc Set the font description. Default is Monospace 12. --rtl Do rtl layout. --paper ps Choose paper size. Known paper sizes are legal, letter, a4. Default is A4. --bottom-margin=bm Set bottom margin in postscript points (1/72 inch). Default is 36. --top-margin=tm Set top margin. Default is 36. --left-margin=lm Set left margin. Default is 36. --right-margin=rm Set right margin. Default is 36. --help Show summary of options. --header Draw page header for each page. --markup Interpret the text as pango markup. --encoding=ENCODING Assume the documentation encoding is ENCODING. --lpi Set the lines per inch. This determines the line spacing. --cpi Set the characters per inch. This is an alternative method of specifying the font size. --stretch-chars Indicates that characters should be stretched in the y-direction to fill up their vertical space. This is similar to the texttops behaviour. AUTHOR
paps was written by Dov Grobgeld <dov.grobgeld@gmail.com>. This manual page was written by Lior Kaplan <kaplan@debian.org>, for the Debian project (but may be used by others). April 17, 2006 PAPS(1)
All times are GMT -4. The time now is 03:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy