Hi Chaps,
I'm trying to print the line number of a comma delimited file where the second field in the line is blank using AWK. Here is the code I have so far where am I going wrong. It is the last column in the file.
nawk -v x==0 'BEGIN {FS=",";OFS=","} x++ if ($2 == " ") print $x' bob.tst
... (3 Replies)
Hello, I need help in appending the line number of each line to the file and also to get the total number of lines. Can somebody please help me.
I have a file say:
abc
def
ccc
ddd
ffff
The output should be:
Instance1=abc
Instance2=def
Instance3=ccc
Instance4=ddd
Instance5=ffff
... (2 Replies)
Hi,
I have a huge file & I want to add a specific text in column. But I want to add this text from a specific line number to a specific line number & another text in to another range of line numbers.
To be more specific: lets say my file has 1000 lines & 4 Columns. I want to add text "Hello"... (2 Replies)
hi,
i have a file, i need to search for a string , if the line contains i need to print that line number and line ,
please help
thanks in advance
Satya (5 Replies)
Hi Everybody,
I am trying to write a script that will get some perticuler data from a file and redirect to a file.
My Question is,
I have a Very huge file,In that file I have my required data is started from 25th line and it will ends in 100th line.
I know the line numbers, I need to get all... (9 Replies)
Hello Everyone.
I am trying to display contains of a file from a specific line to a specific line(let say, from line number 3 to line number 5). For this I got the shell script as shown below:
if ; then
if ; then
tail +$1 $3 | head -n $2
else
... (5 Replies)
Hi,
I would like to know how do I print the line # in a script. My requirement is, I have a script which is about ~5000 lines long. If there are any errors happen I just exit. And I would like to add the line # of the script where the error happened.
Thanks, (6 Replies)
Hello,
I have a question on how to find the line number of the first column that contains specific data. I know how to print all the line numbers of those columns, but haven't been able to figure out how to print only the first one that is found.
For example, if my data has four columns:
115... (3 Replies)
Hi,
How to print the number of fields in each record with the line number?
Lets saw I have
3212|shipped|received|
3213|shipped|undelivered|
3214|shipped|received|delivered
I tried the code
awk -F '|' '{print NF}'
This gives me ouput as
3
3
4 (5 Replies)
Hello everyone,
I don't really know anything about scripting, but I have to manage to make this script, out of necessity.
#!/bin/bash
while read -r line; do #I'm reading from a big wordlist
instructions using $line
done
Is there a way to automatically write the $line number the script... (4 Replies)
Discussion started by: bobylapointe
4 Replies
LEARN ABOUT DEBIAN
genders_testattr
GENDERS_TESTATTR(3) LIBGENDERS GENDERS_TESTATTR(3)NAME
genders_testattr - test if a node has an attribute
SYNOPSIS
#include <genders.h>
int genders_testattr(genders_t handle, const char *node, const char *attr, char *val, int len);
int genders_testattrval(genders_t handle, const char *node, const char *attr, const char *val);
DESCRIPTION
genders_testattr() tests if the node pointed to by node contains the attribute pointed to by attr. If node is NULL, the current node is
tested. If the attribute is found, its value is stored in the buffer pointed to by val. len should indicate the length of the buffer. If
the attribute value is not needed, val can be set to NULL.
To avoid passing in an attribute value buffer that is not large enough to store the attribute value, genders_getmaxvallen(3) should be used
to determine the minimum buffer size that should be used.
genders_testattrval() tests if the node pointed to by node contains the attribute pointed to by attr and if that attribute is equal to the
attribute value pointed to by val. If val is NULL, only the attribute is tested.
RETURN VALUES
For genders_testattr(), if the node contains the attribute, 1 is returned. 0 is returned if the node does not contain the attribute.
For genders_testattrval(), if the node contains the attribute and it is equal to the attribute value, 1 is returned. 0 is returned if the
node does not contain the attribute, or if the attribute is not equal to the attribute value.
For both genders_testattr() and genders_testattrval(), -1 is returned on error, and an error code is returned in handle. The error code
can be retrieved via genders_errnum(3) , and a description of the error code can be retrieved via genders_strerror(3). Error codes are
defined in genders.h.
ERRORS
GENDERS_ERR_NULLHANDLE
The handle parameter is NULL. The genders handle must be created with genders_handle_create(3).
GENDERS_ERR_NOTLOADED
genders_load_data(3) has not been called to load genders data.
GENDERS_ERR_OVERFLOW
The buffer pointed to by val is not large enough to store the attribute value.
GENDERS_ERR_PARAMETERS
An incorrect parameter has been passed in.
GENDERS_ERR_NOTFOUND
The node pointed to by node cannot be found in the genders file or if node=NULL, the machine genders is running on is not listed in
the genders database.
GENDERS_ERR_MAGIC
handle has an incorrect magic number. handle does not point to a genders handle or handle has been destroyed by genders_han-
dle_destroy(3).
FILES
/usr/include/genders.h
SEE ALSO libgenders(3), genders_handle_create(3), genders_load_data(3), genders_getmaxvallen(3), genders_errnum(3), genders_strerror(3)LLNL August 2003 GENDERS_TESTATTR(3)