Sponsored Content
Full Discussion: awk - Beginners Question
Top Forums Shell Programming and Scripting awk - Beginners Question Post 302087170 by Amruta Pitkar on Wednesday 30th of August 2006 05:10:14 AM
Old 08-30-2006
awk - Beginners Question

I have my inputfile in the following format :

From:sdhfhg
dsfhsdjfjdsfh
dsfjdjshjsd
djfhsdjfjsdhjds
Error Description
<aa.aa.aa.aa.aa.aa>
From:ksljfsdhfjh
djfdsjkf
sdjwoquk
dsfsdfj
Error Description
<dd.dd.dd.dd.dd>

I want to read the lines from tag 'From:' thrul <aa.aa.aa.aa.aa.aa> similarly for the next block. Next I want to read the Error Description and assign an codenumber to it.

I am using the following code :

Code:
#this is my first awk program
BEGIN {errorcode=0}

/From/ {take actions}
      #Read until next 'From'
       {while!(^/<[a-z]/)
         if (/ErrorDesc1/) print "01"
         else if(/ErrorDesc2/) print "02"
         else if(/ErrorDesc3l/) print "03"}

       {if(errorcode != 01 && errorcode != 02 && errorcode != 03) print "04"}

I get the following error :
The error context is
>>> {while! <<< (^/<[a-z])
awk: The statement cannot be correctly parsed.
The source line is 13.

Can someone guide...I am new to awk programming.
 

8 More Discussions You Might Find Interesting

1. Programming

X-programming for beginners

Good morning. Thanks for the very valuable hard-to-find information I get from you guys. Can anybody give any suggested websites or references for anyone who wants to begin learning on programming applications in X? Thanks to anyone in advance... (1 Reply)
Discussion started by: jfsuminist
1 Replies

2. UNIX Desktop Questions & Answers

unix course for beginners

does anyone know of a course for unix beginners (1 Reply)
Discussion started by: moose
1 Replies

3. UNIX Desktop Questions & Answers

UNIX for beginners

I am new to non Windows operating systems. Does anyone have advice on which UNIX OS vendor would be good for learning purposes. I was looking for a version of UNIX that runs on the Intel platform. Do you have any recommendations on where to purchase the software? Thank you. (14 Replies)
Discussion started by: jmy113437
14 Replies

4. Programming

Beginners question about fork

Hi everyone: I'm developing a dynamic library for notifications, this library is used for a daemon that i've programmed, when something goes wrong the library should send an email to an administrator, but since sending an email is a non-vital process then it can fail (it should work as an... (4 Replies)
Discussion started by: edgarvm
4 Replies

5. Shell Programming and Scripting

awk beginners question

hi, i start using awk and have a very basic problem. here's my code: #! /usr/bin/awk -f # 2010, scz # { $1 == "test" { print $2 } } this works on the command line but not as "program" - what is the difference between awk programs on the command line and executing awk... (3 Replies)
Discussion started by: svencz
3 Replies

6. Shell Programming and Scripting

Shell program for beginners

Hey, i hope someone can help me with this program. I need to write a program in shell which will return how many times and how much time have users been logged in system between two dates. We give time as 2 dates as arguments in command line. Example: $ nameofprogram 27/04 06/05 ... (1 Reply)
Discussion started by: Exander
1 Replies

7. UNIX for Dummies Questions & Answers

UNIX for beginners

i'm just a beginner in unix environment- please help which book to read and which os to use!!! :confused: seriously i've no idea what is unix or how much capable it is!! (1 Reply)
Discussion started by: gaurav singh
1 Replies

8. UNIX for Dummies Questions & Answers

UNIX ebook for beginners

hi all, Can you suggest me a ebook for unix beginners. I am new to unix. (2 Replies)
Discussion started by: rajasingam
2 Replies
Error Construction(3)						globus gssapi error					     Error Construction(3)

NAME
Error Construction - Defines #define GLOBUS_ERROR_TYPE_GSSAPI Construct Error globus_object_t * globus_error_construct_gssapi_error (globus_module_descriptor_t *base_source, globus_object_t *base_cause, const OM_uint32 major_status, const OM_uint32 minor_status) Initialize Error globus_object_t * globus_error_initialize_gssapi_error (globus_object_t *error, globus_module_descriptor_t *base_source, globus_object_t *base_cause, const OM_uint32 major_status, const OM_uint32 minor_status) Detailed Description Create and initialize a Globus GSSAPI Error object. This section defines operations to create and initialize Globus GSSAPI Error objects. Define Documentation #define GLOBUS_ERROR_TYPE_GSSAPI Error type definition. Function Documentation globus_object_t* globus_error_construct_gssapi_error (globus_module_descriptor_t *base_source, globus_object_t *base_cause, const OM_uint32major_status, const OM_uint32minor_status) Allocate and initialize an error of type GLOBUS_ERROR_TYPE_GSSAPI. Parameters: base_source Pointer to the originating module. base_cause The error object causing the error. If this is the original error, this paramater may be NULL. major_status The GSSAPI major status minor_status The GSSAPI minor status Returns: The resulting error object. It is the user's responsibility to eventually free this object using globus_object_free(). A globus_result_t may be obtained by calling globus_error_put() on this object. globus_object_t* globus_error_initialize_gssapi_error (globus_object_t *error, globus_module_descriptor_t *base_source, globus_object_t *base_cause, const OM_uint32major_status, const OM_uint32minor_status) Initialize a previously allocated error of type GLOBUS_ERROR_TYPE_GSSAPI. Parameters: error The previously allocated error object. base_source Pointer to the originating module. base_cause The error object causing the error. If this is the original error this paramater may be NULL. major_status The GSSAPI major status minor_status The GSSAPI minor status Returns: The resulting error object. You may have to call globus_error_put() on this object before passing it on. Author Generated automatically by Doxygen for globus gssapi error from the source code. Version 4.1 Wed Jan 25 2012 Error Construction(3)
All times are GMT -4. The time now is 08:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy