Sponsored Content
Top Forums Shell Programming and Scripting Trying to learn to use functions in gawk and not getting expected output. Post 302842945 by MadeInGermany on Sunday 11th of August 2013 10:30:06 AM
Old 08-11-2013
You can omit the { }braces after an if or a for if there is only one statement in it.
It has nothing to do with calling function.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

GAWK removes FS | on output

I have the simple gawk script below. When the script runs in the output of all the ITM lines the FS is replaced with a space, the Non ITM lines retain the | field separator. The ITM lines have many fields and I can't insert "|" between each field because some of the fields are blank. Is... (1 Reply)
Discussion started by: paulr211
1 Replies

2. Shell Programming and Scripting

awk not generating the expected output

Hi, I am presently stuck in a csv file. INPUT CSV baseball,NULL,8798765,Most played baseball,NULL,8928192,Most played baseball,NULL,5678945,Most played cricket,NOTNULL,125782,Usually played cricket,NOTNULL,678921,Usually played EXPECTED OUTPUT CSV ... (7 Replies)
Discussion started by: scripter12
7 Replies

3. Shell Programming and Scripting

Output is not comming as expected

Hi All, I am in middle of one script. I want output in the form of xls file. There are 4 fields - user name, email Id, full name, date of birth. I want these details to get in seperate columns. But, i am getting it in the single cell and as like a paragraph.:mad: Please suggest me some... (8 Replies)
Discussion started by: Agupte
8 Replies

4. Shell Programming and Scripting

Not getting expected output

Hi I have written below script to get the data in table form. #!/bin/sh echo "File Name\tType" for i in *; do echo "$i\t\c" if ; then echo "directory" elif ; then echo "symbolic link" elif ; then echo "file" else echo "unknown" fi donehowever i am getting output in different way... (3 Replies)
Discussion started by: scriptor
3 Replies

5. Shell Programming and Scripting

Gawk output difference

Why the below option2 doesn't fetch similar output as option1 ? I am on linux. $cat test 2013-01-01-00.25.43.643845 Option1: cat test | gawk -F"-" ' {print $2 " " $3 " " $1}' 01 01 2013 Option2: cat test | gawk '{FS="-"} {print $2 " " $3 " " $1}' 2013-01-01-00.25.43.643845 (5 Replies)
Discussion started by: Shivdatta
5 Replies

6. Shell Programming and Scripting

Local variable in functions (gawk)

Hi Everybody :) I need your help, because i know a local variable in a function for example k, it is different of other variable(with the same name k) this a global variable. Is that right? dgawk> run Starting program: 3238860128818202 3 4 7 11 12 13 17 22 23 32 35 37 41 48 49 55 63 ... (5 Replies)
Discussion started by: solaris21
5 Replies

7. Shell Programming and Scripting

awk output not what was expected

Good Moring, I am currently reading about awk in a manual and following the examples using the oratab file. My system is SOLARIS 10 I think I am getting strange behavior judging by what the book says to do and what I am getting with my little program. Here is my program: grep -v oratab |... (4 Replies)
Discussion started by: bdby
4 Replies

8. Shell Programming and Scripting

Gawk output separated by tab

In the gawk below, I am trying to output the file tab-deliminated but don't think that is the correct syntax. Thank you :). gawk OFS='/t' '{sub(/-+/,"",$2); ar=$0} END{n = asort(ar) for (i = 1; i <= n; i++) print ar}' file (2 Replies)
Discussion started by: cmccabe
2 Replies

9. Shell Programming and Scripting

For loop not giving expected output

#cat /tmp/input old_array old_dev new_dev new_array 0577 008AB 01744 0125 0577 008AC 01745 0125 0577 008AD 005C8 0125 0577 008AE 005C9 0125 0577 008AF 005CA 0125 0577 008B0 005CB 0125 0577 008B1 005CC 0125 cat test.sh #!/bin/ksh... (4 Replies)
Discussion started by: mbak
4 Replies

10. Shell Programming and Scripting

awk not giving the output expected

Hello, I am practising awk and decided to compare two columns and print the result of the comparison as third column i/p data c1,c2,c3 1,a,b 1,b,b i am trying to compare the last two columns and if they match I am trying to print match else mismatch(Ideally i want that as a last column... (5 Replies)
Discussion started by: mkathi
5 Replies
AMPLOT(8)						  System Administration Commands						 AMPLOT(8)

NAME
amplot - visualize the behavior of Amanda SYNOPSIS
amplot [-b] [-c] [-e] [-g] [-l] [-p] [-t T] amdump_files DESCRIPTION
Amplot reads an amdump output file that Amanda generates each run (e.g. amdump.1) and translates the information into a picture format that may be used to determine how your installation is doing and if any parameters need to be changed. Amplot also prints out amdump lines that it either does not understand or knows to be warning or error lines and a summary of the start, end and total time for each backup image. Amplot is a shell script that executes an awk program (amplot.awk) to scan the amdump output file. It then executes a gnuplot program (amplot.g) to generate the graph. The awk program is written in an enhanced version of awk, such as GNU awk (gawk(1) version 2.15 or later) or nawk(1). During execution, amplot generates a few temporary files that gnuplot uses. These files are deleted at the end of execution. See the amanda(8) man page for more details about Amanda. OPTIONS
-b Generate b/w postscript file (need -p). -c Compress amdump_files after plotting. -e Extend the X (time) axis if needed. -g Direct gnuplot output directly to the X11 display (default). -p Direct postscript output to file YYYYMMDD.ps (opposite of -g). -l Generate landscape oriented output (needs -p). -t T Set the right edge of the plot to be T hours. The amdump_files may be in various compressed formats (compress, gzip, pact, compact). INTERPRETATION
The figure is divided into a number of regions. There are titles on the top that show important statistical information about the configuration and from this execution of amdump. In the figure, the X axis is time, with 0 being the moment amdump was started. The Y axis is divided into 5 regions: QUEUES: How many backups have not been started, how many are waiting on space in the holding disk and how many have been transferred successfully to tape. %BANDWIDTH: Percentage of allowed network bandwidth in use. HOLDING DISK: The higher line depicts space allocated on the holding disk to backups in progress and completed backups waiting to be written to tape. The lower line depicts the fraction of the holding disk containing completed backups waiting to be written to tape including the file currently being written to tape. The scale is percentage of the holding disk. TAPE: Tape drive usage. %DUMPERS: Percentage of active dumpers. The idle period at the left of the graph is time amdump is asking the machines how much data they are going to dump. This process can take a while if hosts are down or it takes them a long time to generate estimates. BUGS
Reports lines it does not recognize, mainly error cases but some are legitimate lines the program needs to be taught about. SEE ALSO
amanda(8), amdump(8), gnuplot(1), compress(1), gzip(1) The Amanda Wiki: : http://wiki.zmanda.com/ AUTHORS
Olafur Gudmundsson <ogud@tis.com> Trusted Information Systems Stefan G. Weichinger <sgw@amanda.org> Amanda 3.3.3 01/10/2013 AMPLOT(8)
All times are GMT -4. The time now is 03:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy