Sponsored Content
Homework and Emergencies Homework & Coursework Questions Awk Script that implements a report writer Post 302476340 by birei on Wednesday 1st of December 2010 01:05:49 PM
Old 12-01-2010
Hi,

Could be something like this? I had to change spaces to tabs and output should be formatted better, but I hope you get the idea.
Code:
$ tail -n6 report        ## Part of the script supressed.
END {
    for (s in sales) {
    match(s, /(.*):(.*)/, a);
    printf("%-30s\t%-20s\t%20.2f\n", a[1], a[2], sales[s]) | "sort -t\"\t\" -nr -k3"
    } 
}
$ awk -f report inputfile
Lazy Acres, Inc.
2009 Sales Associates Ranking
Name                           Position                     Sales amount
========================================================================
Buck, Fast                      Stock Boy                            2398.89
Rush, George                    Salesman                             1059.67
Worker, Susan                   Manager                               139.76
Doe, John                       Clerk                                 134.01
Lindon, Rosemary                Producer                               31.00
Miller, Dennis                  Comedian                                8.91

Regards,
Birei
This User Gave Thanks to birei For This Post:
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Share CD-Writer

Hi, guys ! I have a server that runs FreeBSD 5.3 and on that server a have a CD-Writer used for backup. The question is, does anybody know how can I share this CD-Writer ? I want to be able to write CDs from another computer, without transfering all the data to the server and after that use all... (2 Replies)
Discussion started by: Sergiu-IT
2 Replies

2. UNIX for Advanced & Expert Users

Probleme With DVD Writer

I Use mkcd for save same directories into DVD, But the commande not complete succefuly mkcd -r directorie_i_whish_save -d /dev/cd1 please it is very urgent thank you :confused: :confused: (1 Reply)
Discussion started by: mktahar
1 Replies

3. AIX

Probleme with DVD Writer

I can write into DVD? I have USE "MKCD" command mkcd -r directorie -d /dev/cd1 please help me it s urgent (2 Replies)
Discussion started by: mktahar
2 Replies

4. Shell Programming and Scripting

Awk Script for generating a report

Hi all, I have a log file of the below format. 20081016:000042 asdflasjdf asljfljs asdflasjf safjl 20081016:000229 /lask/ajlsdf/askdfjsa 20081016:000229 /lashflas /askdfaslj hsfhsahf 20081016:000304 lasflasj ashfashd 20081016:000304 lajfasdf ashfashdfhs I need to generate a... (3 Replies)
Discussion started by: manoj.naidu
3 Replies

5. Homework & Coursework Questions

How Unix implements virtual memory?

Use and complete the template provided. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: The key to using memory most efficiently is virtual memory management. Consider both Windows and UNIX operating systems. Compare and contrast how each... (0 Replies)
Discussion started by: kjcruz
0 Replies

6. HP-UX

How Unix implements virtual memory?

Hello! just wanna ask if how UNIX implements virtual memory, and how it handles page faults, working sets, page sizes and how it reconciles thrashing issues? if you know some sources where I can have some idea, just post it here. thx (1 Reply)
Discussion started by: kjcruz
1 Replies

7. Homework & Coursework Questions

awk script that implements a report writer

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: The script should compute the sale amounts per associate for the year 2009 and print them in a sorted list ranked... (1 Reply)
Discussion started by: Jeffthrow5
1 Replies

8. UNIX for Advanced & Expert Users

How to implements Queueing Using Shell scripts

I want to implement a control mechanism using Shell scripts .The intention is to have controlled number of jobs running in parallel External process will kickstart 40 jobs in parallel .All the 40 jobs will call the same generic script with different parameter values .But at a time only 2 should... (1 Reply)
Discussion started by: police
1 Replies
show object(1m) 														   show object(1m)

NAME
show object - Displays attribute information about the specified object entry SYNOPSIS
cdscp show object object-name [attribute-name] [with attribute-name = attribute-value] ARGUMENTS
The full name of a specific object entry. The last simple name can contain wildcard characters. The name of a particular attribute; see Description for valid attribute names. The value of a particular attribute. DESCRIPTION
The show object command displays the names and values of the attributes specified in attribute-name. You can use a combination of attributes in a single command. Use a space to separate multiple attributes. You can use a with attribute-name = attribute-value clause to limit output only to object entries whose attributes have values equal to the specified values. If you do not supply any attributes, the command displays all attributes and their values. In addition to the following attributes, any application-defined attributes that might exist will be included in the output of this command. The following is a description of object entry attributes: Specifies the class to which an object belongs. Contains the version number of the object's class. This allows applications to build in compatibility with entries created by earlier versions. Specifies the creation timestamp (CTS) of this object entry. Specifies a unique identifier for the object being referenced. Specifies the timestamp of the most recent update to an attribute of the object entry. Privilege Required You must have read permission to the object entry. If you specify a wildcard object entry name, you also need read permission to the directory that stores the object entry. NOTE
This command is replaced at Revision 1.1 by the dcecp command and may not be provided in future releases of DCE. EXAMPLE
The following command lists all the attributes and their values of the object entry /.:/sales/east/floor1cp. cdscp> show object /.:/sales/east/floor1cp SHOW OBJECT /.../abc.com/sales/floor1cp AT 1991-10-15-15:53:07 CDS_CTS = 1991-10-15-19:53:03.00000003/08-00-2b-1c-8f-1f CDS_UTS = 1991-10-15-19:53:03.00000006/08-00-2b-1c-8f-1f RELATED INFORMATION
Commands: add object(1m), create object(1m), delete object(1m), list object(1m), remove object(1m), set object(1m) show object(1m)
All times are GMT -4. The time now is 08:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy