Sponsored Content
Full Discussion: Using sort with awk script
Top Forums Shell Programming and Scripting Using sort with awk script Post 302151237 by rikxik on Friday 14th of December 2007 01:27:18 AM
Old 12-14-2007
@shamrock

Well, we learn new things every day - I didn't know that we could pipe out stuff to external programs - within awk! Smilie

@Trellot

Glad that the solution works for you. Just my 2c - avoid doing formatting before data processing. You are first formatting (using printf) and then processing the formatted data (using sort). Tommorrow if you change your formatting printf, you will be forced to change your sort routine too.
 

9 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

awk sort help

1. The problem statement, all variables and given/known data: I dont know what I do wrong, I am trying to create shell programming database: I have this command first: && > $fname ... echo $Name:$Surname:$Agency:$Tel:$Ref: >> $fname then I have echo " Name Surname Agency Tel... (2 Replies)
Discussion started by: jeht
2 Replies

2. Shell Programming and Scripting

Sort in AWK

Hi, I usually use Access to sort data however for some reason its not working. Our systems guys and myself cannot figure it out so ive tried to use AWK to do the sorting. The file is made up of single lines in the format ... (4 Replies)
Discussion started by: eknryan
4 Replies

3. UNIX for Advanced & Expert Users

Script to sort the files and append the extension .sort to the sorted version of the file

Hello all - I am to this forum and fairly new in learning unix and finding some difficulty in preparing a small shell script. I am trying to make script to sort all the files given by user as input (either the exact full name of the file or say the files matching the criteria like all files... (3 Replies)
Discussion started by: pankaj80
3 Replies

4. Shell Programming and Scripting

How do I sort two arrays using awk?

Hi How do I sort two arrays in a ascending order? I'm just doing this to teach myself a book my dad got me on unix. The arrays are A and B and both are including values taken from a file input by the user. How do I arrange the contents of both arrays so that they are both ordered from... (3 Replies)
Discussion started by: razrnaga
3 Replies

5. Shell Programming and Scripting

Awk script to sort and display total occurancies

Hi I am not a good awk programer but the below code serving my purpose Input process 12936 user-name 15u IPv4 7438309 0t0 TCP prdabc.cesi.com:42016->efh.ijk.com:50002 (ESTABLISHED) process 12942 user-name 13u IPv4 7764990 0t0 TCP abc.abc.com:9402->192.168.1.1:63919... (2 Replies)
Discussion started by: rakeshkumar
2 Replies

6. Shell Programming and Scripting

awk sort

input file abc1 abc23 abc12 abc15 output abc1 abc12 abc15 abc23 (9 Replies)
Discussion started by: yanglei_fage
9 Replies

7. Homework & Coursework Questions

Shell script/awk to sort text

1. The problem statement, all variables and given/known data: I have a file with a fragment of a novel, which I have to clear from punctuation and sort all the words contained one per line and non duplicated, all this going to a file called "palabras". Here is fragment of the input file: ... (4 Replies)
Discussion started by: ektorzoza
4 Replies

8. Shell Programming and Scripting

awk pipe to sort

In the below awk to add a sort by smallest to largest should it be added after the END? Thank you :). BEGIN { FS="*" } # Read search terms from file1 into 's' FNR==NR { s next } { # Check if $5 matches one of the search terms for(i in s) { if($5 ~ i) { ... (4 Replies)
Discussion started by: cmccabe
4 Replies

9. UNIX for Beginners Questions & Answers

Shell script to call and sort awk script and output

I'm trying to create a shell script that takes a awk script that I wrote and a filename as an argument. I was able to get that done but I'm having trouble figuring out how to keep the header of the output at the top but sort the rest of the rows alphabetically. This is what I have now but it is... (1 Reply)
Discussion started by: Eric7giants
1 Replies
EvmEventFormat(3)					     Library Functions Manual						 EvmEventFormat(3)

NAME
EvmEventFormat, EvmEventFormatFromTemplate, EvmVarFormat - Format events for display LIBRARY
EVM Support Library (libevm.so, libevm.a) SYNOPSIS
#include <evm/evm.h> EvmStatus_t EvmEventFormat( char *buffer, size_t length, EvmEvent_t event); EvmStatus_t EvmEventFormatFromTemplate( char *buffer, size_t length, EvmString_t show_template, EvmEvent_t event); EvmStatus_t EvmVarFormat( EvmEvent_t event, const char *var_name, char *buffer, size_t length, EvmBoolean_t trans- late); PARAMETERS
A pointer to a character string to receive the formatted event data. The stored string will be null-terminated, even if truncated, unless the length parameter is zero (0). The maximum length of the output string. If the formatted event is longer than length, the output is truncated. The event to be formatted. The primary template for formatting the output. The name of a variable data item contained in the event whose value is to be formatted. A Boolean value indicating whether I18N translation should be attempted on the variable value. Translation will be attempted if this parameter is EvmTRUE, the variable is of type string and includes an I18N message identifier, and the event contains I18N catalog information. DESCRIPTION
Information contained in an event must be formatted to present it in human-readable form. The event poster supplies formatting information through the event's format data item, and the routines described here provide the event formatting capability. The EvmEventFormat() routine combines the supplied event's format data item with any data items or variables specified in the event's for- mat item that are available in the event, and returns a formatted version of the event in buffer. If the event contains I18N message catalog information, and the catalog is available in the user's locale, the format string is retrieved from the message catalog if possible. If no translation is possible the format string contained in the event is used. If the event does not contain format information, a generic display of the event's name and any variables is produced. The EvmEventFormatFromTemplate() routine also formats the supplied event, but uses the supplied show_template string as its primary format- ting template. Literal characters in the show_template are transferred to the buffer unchanged. Any token of the form @item_name[%width] or @{item_name[%width]} is replaced by the value of the corresponding data item from the supplied event, if it is present. If width is supplied, the value occupies a minumum of width character positions. The item_name is the name of a standard event data item. The special string @@ is replaced by the results of applying EvmEventFormat() to the event. Refer to evmshow(1) and EvmEvent(5) for more information about formatting events for display. EvmVarFormat() retrieves a variable called var_name from the supplied event, and returns a formatted version of its value in buffer. I18N translation is applied as appropriate if the value of translate is EvmTRUE. NOTES
Floating point values are formatted using the printf(3) %.8g format specifier. RETURN VALUES
The operation was completed without error. One of the arguments to the function was invalid. A value in a structure member is invalid. An operation failed because an attempt to acquire heap memory failed. ERRORS
None FILES
None SEE ALSO
Commands: evmshow(1) Routines: EvmEventDump(3), printf(3), setlocale(3) Files: locale(4) Event Management: EVM(5) EVM Events: EvmEvent(5) Common Desktop Environment: Programmer's Guide delim off EvmEventFormat(3)
All times are GMT -4. The time now is 05:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy