awk UNIX


 
Thread Tools Search this Thread
Operating Systems AIX awk UNIX
# 1  
Old 10-23-2014
awk UNIX

friends because I get this error when calling awk
Code:
awk: 0602-546 Can not find or open file estdistica.awk.


Last edited by zaxxon; 10-23-2014 at 11:28 AM.. Reason: code tags
# 2  
Old 10-23-2014
Show your command line and start using code tags as explained in the PM you got when doing so, thanks.
# 3  
Old 10-23-2014
friends because I get this error when calling awk
please!!!

Code:
awk: 0602-546 Can not find or open file estdistica.awk.

# 4  
Old 10-23-2014
I'll take a wild guess that the error probably means exactly what it says... That it can't find the file. Or, possibly, can't open it.

So think about that a little. What does that mean? Why might it not be able to find the file?
  • Where is the file?
  • How is your script run, from where? What is its current directory?
  • How is awk being called? awk ... -f something what is the <something>? What is the entire line, really?

etc.

Troubleshooting "can't open it":
  • What are its permissions? ls -l estdistica.awk

Please start answering the obvious questions.
# 5  
Old 10-23-2014
this is what I have
Code:
valida_cab_det.sh(File contended)

awk -f estdistica.awk < /home/aptcam1/shell/$1 >> /home/aptcam1/shell/Estaditica$1.txt

estadistica.awk ((File contended)

BEGIN {
        #VARIABLES PARA CARGOS

        cargo_sum=0;
        saldo_sum=0;
        trafico_sum=0;
        total=0;


        #variable para no contar la cabecera
        cat=0;

      }
     {
        if (cat != 0)
        {
                #RESCATO LA SUMATORIA DE LOS REGISTRO
                if (substr($0, 20,1) =="1" )
                {
                        # Genera Cabecera
                        cargo_sum=cargo_sum+1;
                        total_cabecera=substr($0, 1,157);
                        printf ("%s\n",total_cabecera);
                }

        }
        cat=1;

      }
END
{
}

# 6  
Old 10-23-2014
Is that one file, two files, or three files? Which is which?

Please answer all my questions which you didn't answer from post #4, too.
# 7  
Old 10-23-2014
so is this look

Code:
file 1: valida_cab_det.sh
awk-f estdistica.awk </ home / aptcam1 / shell / $ 1 >> /home/aptcam1/shell/Estaditica$1.txt

Code:
file 2:estadistica.awk 
BEGIN 
    {
        #VARIABLES PARA CARGOS

        cargo_sum=0;
        saldo_sum=0;
        trafico_sum=0;
        total=0;


        #variable para no contar la cabecera
        cat=0;

      }
     #{
      #  if (cat != 0)
       # {
                #RESCATO LA SUMATORIA DE LOS REGISTRO
                #if (substr($0, 20,1) == "1" )
                #{
                        # Genera Cabecera
                 #       cargo_sum=cargo_sum+1;
                  #				  total_cabecera=substr($0, 1,157);
                   #     printf ("%s\n",total_cabecera);
                 # }

       # }
        #cat=1;

      #}
END

to execute the file 1 ( valida_cab_det.sh) gives the following error: awk: 0602-546 Can not find or open file estdistica.awk.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. How to Post in the The UNIX and Linux Forums

Help me in awk or sed in UNIX

I have a fixed length file that looks like a@ a00 a00000 a00 a000000 a00 a0000 a0000 a00000000 a01 a@ a1 a2 a11 a22 a12 a13 a44 a45 a54 a65 a76 a77 a@ a1 a3 a6 a7 a9 a8 a2 a7 a8 a8 a9 a0 b@ b00 b00000 b00... (1 Reply)
Discussion started by: RJG
1 Replies

2. UNIX for Dummies Questions & Answers

UNIX inquiry for 'awk'

Hello Everyone, May I ask for your help regarding one of the UNIX command “awk”. So I executed a script and the output looks like this (see below): output.txt CONTRACTNAME ... (3 Replies)
Discussion started by: steven_huskie
3 Replies

3. UNIX for Advanced & Expert Users

awk sub command in Unix

Hi, I am new to unix shell script and I have some trouble on the awk sub I would like to pick the Date "July 10 2012" into $corr_date by using sub() function, but it is not successful. The inputted text file: pic.*.txt July 10 2012 20:30:50 , 1234567.jpg July 10 2012 20:30:52 , 5648978.jpg... (1 Reply)
Discussion started by: meroko
1 Replies

4. Shell Programming and Scripting

Help in unix in awk

Hi, I have a file as given below $cat int_check 239|adf123@yahoo.com|999e 23e|get@rediff.com|987 233|get@rediff.com|987 I am running the command as given to find whether field 1 and 3 have proper integer values or not. awk -F'|' 'int($1)!=$1 || int($3)!=$3' int_check... (7 Replies)
Discussion started by: ashwin3086
7 Replies

5. UNIX for Dummies Questions & Answers

AWK Help (New to UNIX)

Write a script to calculate the average score and assign a letter grade for each student, also compute the average score for every test (the source data is in the file “grades”). Output all students' name, scores, and grades in descending order of the average score. Note: please save the output to... (17 Replies)
Discussion started by: dsptl
17 Replies

6. Shell Programming and Scripting

need help with UNIX and awk

Hi, I am working on a script where i am fetching a word from a parameter file and using it as output file name . here is the part of parameter file contents : it basically contains SQL statements. Select 'SSFNRTP' as TABLE_NAME,UCSTDT,CVOFIDKEY from (Select 'cofvof_interface' as... (2 Replies)
Discussion started by: manmeet
2 Replies

7. UNIX for Dummies Questions & Answers

Clock in Unix using awk

Hey everyone! Can someone help me, i need to make a program using awk, that displays the current time (hh/mm/ss), i would really apreciate it! Thanks! Alex. (4 Replies)
Discussion started by: alex_omul
4 Replies

8. Shell Programming and Scripting

unix awk scripting

Hi can anyone pls help me out in knowing how a array of elements which are fetched from database is passed to the awk program. Something like this #!/bin/sh AMT=`sqlplus -s usrname/pswd <<EOD set pagesize 0 feedback off verify off heading off echo on select amount from... (11 Replies)
Discussion started by: shaik
11 Replies

9. UNIX for Dummies Questions & Answers

UNIX awk help

I am new to UNIX and I need a sample awk or sed program to solve the following problem. I have a file with the following format. The file is comma delimited. Each record has header information followed by looping detailed information. In addition the detailed information will vary based on a... (2 Replies)
Discussion started by: royayala
2 Replies

10. Shell Programming and Scripting

Unix To Awk

How do I alias the FILE name into awk? gawk -f awk_script FILE or FILE | gawk awk_script for FILE in `find ./* -prune -type f -newer ./TIMEFILE` do # Need to have the actual FILE name ran thru an awk script done (1 Reply)
Discussion started by: goodmis
1 Replies
Login or Register to Ask a Question