Sponsored Content
Full Discussion: AWK syntax help
Top Forums Shell Programming and Scripting AWK syntax help Post 302414633 by usustarr on Tuesday 20th of April 2010 03:10:11 PM
Old 04-20-2010
what do you mean by trace? This is what i see in the command prompt.

flipper> roboSheriff.ksh
../sbin/roboSheriff.ksh[29]: syntax error at line 98 : `(' unexpected



Code:
51    endMarker="NSC Termination Event Details:"
    52
    53    if [ ! -f $4 ] ; then
    54      echo "No $4 file found.  Perhaps testMgr is still running?"
    55
    56    else
    57
    58      # Subtract out a little from the start time.  Otherwise we miss
    59      # crashes because of the controller clocks being off by a few seconds.
    60      #dateFilter $4 $(( $2 - 10 )) $3 > $con
    61
    62      # BGL -- analyze all of the consoles.  Autotest does the trimming now.
    63
    64      termReport.pl < $4 | dos2ux |  head -2000 | awk '
    65      BEGIN { foundTermEvent=0;
    66              endMarker="'"${endMarker}"'"; }
    67
    68      {
    69        if ( (substr($0, 1, length(endMarker)) == endMarker) ||
    70             (substr($0, 1, 39) == "'${SBINDIR}'/termReport.pl: ") )
    71        {
    72          if (foundTermEvent == 1)
    73          {
    74            print "";
    75            foundTermEvent=0;
    76          }
    77        }
    78        ##############################################################################
    79         if (foundTermEvent == 1)
    80         {
    81                  # if ( $(print - "${ignore[@]}" | grep -c "$2") -gt 0 ) ; then
    82                  # print - " FOUND $2 IN ARRAY IGNORE[] "
    83           #       { print $1 }
    84           #       { print $2 }
    85           #        foundTermEvent = 0;
    86           #       print " Z= " z
    87           #       print " ignore[$z] = " ignore[z]
    88           #       print " ignore[$z] = " ignore[z]
    89
    90                  # else
    91                   #print;
    92                  # print - " DID NOT FIND $2 IN ARRAY ignore[ ] "
    93                   #{ print $2 }
    94                   #print " ########################## "
    95                  # fi
    96
    97                  print - "${ ignore[@] }" | awk -v searchStr="$2" ' searchStr { print "found $2 in array ignore[]";flag=1; exit }
    98                  END { if (flag != 1) { print "did not find $2 in array ignore[]" } } '
    99
   100         }
   101  ####################################################################
   102        if (substr($0, 1, 18) == "Termination Event:")
   103        {
   104          foundTermEvent=1;
   105        }
   106      }'
   107  
   108    fi
   109  }
   110  
   111  
   112  function analyzeFailure

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with Awk Syntax

I have written many awk commands which go in multiple lines. I have this confusion many times. Some time they work if i dont terminate them with "\" but some time error. Some time in "if" statements between if and else if i dont use ";" it gives error but sometimes it doesnt. The below... (4 Replies)
Discussion started by: pinnacle
4 Replies

2. Shell Programming and Scripting

awk syntax help

I don't get correct output when I run this command line: nmap -sP failedhost.com | grep -i failed | awk -F '{print $6}' I basically want it to return 'failedhost.com' but its just showing the output of the nmap scan. (8 Replies)
Discussion started by: streetfighter2
8 Replies

3. Shell Programming and Scripting

AWK syntax

Hi I am trying to understand AWK syntax so I tried this command which gives me the home directory of root awk 'BEGIN { FS = ":"} {if ($1 == "root") print $6 }' /etc/passwd I would know what are the following commands doing. The first one prints all /etc/passwd, second prints nothing. ... (4 Replies)
Discussion started by: wakatana
4 Replies

4. UNIX for Dummies Questions & Answers

awk syntax

Little bit confusing while using awk :confused::confused: In Sed while pattern search we can use "(double quotes) i mean $a=hello $cat file.txt |sed -n "/$a/p"this thing work fine But if i use it in awk it's not working How could i do the substitution of pattern by a variables and the... (1 Reply)
Discussion started by: posix
1 Replies

5. AIX

Help with syntax using AWK

I have a file which is comma separated and has quotes. I can use this command and awk -F"," '{ if ($4=="01" print $0 }' test.txt But this doesn't fetch me the data.since it has quotes. If the data has no quotes,the above command works fine. In Unix you can skip quote \" but this doesn't work.... (7 Replies)
Discussion started by: ganesnar
7 Replies

6. Shell Programming and Scripting

awk syntax

Hi I have a bash file which will split a big file to many small files. But I got a syntax error.H="$(head -1 CCC.tped)" awk 'print $0 > $1 ".tped"' CCC.tped for f in $(ls *.tped); do echo "$H\n" "$(cat $f)" >$f; done And -bash-4.1$ bash split awk: print $0 > $1".tped" awk: ^ syntax error... (3 Replies)
Discussion started by: zhshqzyc
3 Replies

7. Shell Programming and Scripting

AWK Function syntax

Hi, I would like to know what is the correct syntax to perform a function in awk. Although I have seen several examples, not get it to work, this is what I'm trying: #!/bin/bash awk function multi (number) { return number * 3 } print multi (4)Thanks (2 Replies)
Discussion started by: Godie
2 Replies

8. Shell Programming and Scripting

Syntax Problem with awk

Hello, I have perl script,which take some part of data in the file. the below command works fine in normal cmd prompt. `awk '/CDI/ && // && !/Result for/ {print $3 $5 > "final.txt"}' datalist.txt`; `nawk -F"" '{print $2}' finalcdi.txt`; But not working. Please use code tags, thanks. (5 Replies)
Discussion started by: rasingraj
5 Replies

9. Shell Programming and Scripting

Help with the awk syntax

Hello Experts: While writing a script to help one of the posts on here, I end up writing a wrong one. I am very much eager to know how this can be corrected. Aim was to not print specified columns - lets say out of 100 fields, need to print all but 5th, 10th, 15th columns. Someone already... (13 Replies)
Discussion started by: juzz4fun
13 Replies

10. Shell Programming and Scripting

Awk: syntax error

awk -F, ' NR>1 { BEGIN{ chr=$2 } END{ for (k in chr) {print k} } } ' $gene_file I've a really simple code. I want to store gene name and it's chromosome and in the end print them. I'm skipping line one as it contains headers. But I don't know why I get error as: (2 Replies)
Discussion started by: genome
2 Replies
ID(1)								   User Commands							     ID(1)

NAME
id - print real and effective user and group IDs SYNOPSIS
id [OPTION]... [USER] DESCRIPTION
Print user and group information for the specified USER, or (when USER omitted) for the current user. -a ignore, for compatibility with other versions -Z, --context print only the security context of the process -g, --group print only the effective group ID -G, --groups print all group IDs -n, --name print a name instead of a number, for -ugG -r, --real print the real ID instead of the effective ID, with -ugG -u, --user print only the effective user ID -z, --zero delimit entries with NUL characters, not whitespace; not permitted in default format --help display this help and exit --version output version information and exit Without any OPTION, print some useful set of identified information. AUTHOR
Written by Arnold Robbins and David MacKenzie. REPORTING BUGS
GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Report id translation bugs to <http://translationproject.org/team/> COPYRIGHT
Copyright (C) 2017 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
Full documentation at: <http://www.gnu.org/software/coreutils/id> or available locally via: info '(coreutils) id invocation' GNU coreutils 8.28 January 2018 ID(1)
All times are GMT -4. The time now is 10:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy