Sponsored Content
Full Discussion: options with awk
Top Forums Shell Programming and Scripting options with awk Post 51103 by mips on Tuesday 11th of May 2004 06:30:04 AM
Old 05-11-2004
options with awk

Hi everybody,
I have some difficulties to use awk with the right options (as always): i have for example 3 fields:
IF-MIB::ifIndex.1
IF-MIB::ifIndex.2
IF-MIB::ifIndex.3
i want to use "while" to access to these records one by one
so i wrote this script but it didn t return the right value:

(small script which returns the 3 records) | awk 'BEGIN {FS="\n"} { i=1
while (i<4)
{ print $i
i++
}
}'

this returns me all records wheras i want only the first or the second (for example)
which corrections may i do to allow me to access to the right record
Thank you for you help
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

cp options

Hello again, Is there an option for the cp command to overwrite existing files in the destination directory? Cheers Rob (3 Replies)
Discussion started by: milage
3 Replies

2. UNIX for Dummies Questions & Answers

options

I am just beginning to learn unix and I was wondering if there was a list of all the options somewhere on the net or hidden in the man pages? Also do options always have - and then a letter, or can it be - and a number as well? Thanks! (1 Reply)
Discussion started by: terms5
1 Replies

3. AIX

no options

Hi All, I have a situation here that's very fun... I have a system with AIX and iPlanet (sunOne) installed, when occurs an unknown event on the network the WebServer shows a thousand of CLOSE_WAIT connections and this number grows and grows until the webserver crashs. I read some documents... (2 Replies)
Discussion started by: nascimento.rp
2 Replies

4. Shell Programming and Scripting

Awk and checking options

My task is that when the user calls the script 1. If user calls script with awk -v dtmax= -v stdlim= -f ../Scripts/add-rgauss-xt.awk fin.xt > fout.xt rgauss will return mean + (stdlim * sigma) 2. If user calls script with awk -v dtmax= -f ../Scripts/add-rgauss-xt.awk fin.xt > fout.xt... (4 Replies)
Discussion started by: kristinu
4 Replies

5. Shell Programming and Scripting

cut, sed, awk too slow to retrieve line - other options?

Hi, I have a script that, basically, has two input files of this type: file1 key1=value1_1_1 key2=value1_2_1 key4=value1_4_1 ... file2 key2=value2_2_1 key2=value2_2_2 key3=value2_3_1 key4=value2_4_1 ... My files are 10k lines big each (approx). The keys are strings that don't... (7 Replies)
Discussion started by: fzd
7 Replies

6. Shell Programming and Scripting

awk script file command line options

Being new to awk I have a really basic question. It just has to be in the archives but it didn't bite me when I went looking for it. I've written an awk script, placed it in a file, added the "#!/usr/bin/awk -f" at the top of the script and away I go. "% myAwk <inputfile>" gives me exactly what... (2 Replies)
Discussion started by: tomr2k
2 Replies

7. Ubuntu

Kernel boot options removed by fault, no boot options

Hello Everyone, First of all, I highly appreciate all Linux forum members and whole Linux community. http://forums.linuxmint.com/images/smilies/icon_wink.gif. I wish you the best for all of you ! I will try to be short and concise: I am using Linux Mint 10 for 2 months on 2 ws, and all went... (3 Replies)
Discussion started by: cdt
3 Replies

8. Shell Programming and Scripting

Matching options from ARGV in awk

I have written this code in an awk script. BEGIN { print "ARGV", ARGV if ( match(ARGV,/-u/) || match(ARGV,/--usg/) ) { print "MATCH -u:",match(ARGV,/-u/), RSTART, RLENGTH print "MATCH --usg:",match(ARGV,/--usg/), RSTART, RLENGTH usage() exit(1) } } I want... (7 Replies)
Discussion started by: kristinu
7 Replies
smi_render(3)						SMI Management Information Library					     smi_render(3)

NAME
smiRenderOID, smiRenderValue, smiRenderNode, smiRenderType - SMI data and MIB data rendering routines SYNOPSIS
#include <smi.h> char *smiRenderOID(unsigned int oidlen, SmiSubid *oid, int flags); char *smiRenderValue(SmiValue *smiValuePtr, SmiType *smiTypePtr, int flags); char *smiRenderNode(SmiNode *smiNodePtr, int flags); char *smiRenderType(SmiType *smiTypePtr, int flags); DESCRIPTION
These functions provide can be used to render OIDs, values of MIB data, or names of MIB nodes or types. The smiRenderOID() function renders an OID given by its length oidlen and its array of sub-identifiers oid*. The flags can be used to con- trol the resulting format, see FORMATS below. The smiRenderValue() function renders a MIB data value given by smiValuePtr. An underlying type smiTypePtr may be supplied to support a more human friendly rendering. The flags can be used to control the resulting format, see FORMATS below. The smiRenderNode() function renders the name of a node given by smiNodePtr. The flags can be used to control the resulting format, see FORMATS below. The smiRenderType() function renders the name of a type given by smiTypePtr. The flags can be used to control the resulting format, see FORMATS below. FORMATS
Each of these functions gets a last argument named flags. This is a logcially or-ed set of flags that can be used to control the format of the rendered items: SMI_RENDER_NUMERIC Allow numeric representation (default). SMI_RENDER_NAME Allow a representation by name(s) if possible. SMI_RENDER_QUALIFIED In case of a name representation, force a module prefix, e.g. IF-MIB::ifIndex instead of just ifIndex. SMI_RENDER_FORMAT In case of smiRenderValue(), force the application of a format specification (e.g. an SMIv2 DISPLAY-HINT) of an underlying type if the smiTypePtr argument is not NULL and this type contains such a format specification. SMI_RENDER_PRINTABLE In case of octet string value rendering, force a printable representation if all octets of the octet string are printable. SMI_RENDER_UNKNOWN Force the return of a string containing SMI_LABEL_UNKNOWN ("<unknown>"), if the rendering would fail. This way, the only condition where NULL can be returned is the lack of memory. SMI_RENDER_ALL Apply a combination of all these flags. This supports the (hopefully) most human friendly representations. RETURN VALUE
All of these functions return a string, if successful, or NULL in case of a rendering failure. See also the SMI_RENDER_UNKNOWN flag above. SEE ALSO
libsmi(3), smi.h AUTHOR
(C) 2002 Frank Strauss, TU Braunschweig, Germany <strauss@ibr.cs.tu-bs.de> IBR
July 24, 2002 smi_render(3)
All times are GMT -4. The time now is 05:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy