Sponsored Content
Top Forums Shell Programming and Scripting Using awk to select one field Post 302887930 by RudiC on Tuesday 11th of February 2014 04:24:36 PM
Old 02-11-2014
Or supply a format string to printf.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

select last field from a file

hi everybody i would to select the last field of a file here as you can see i select the field number 8 y=`cat sortie2 | grep "^"| grep "starting"| awk '{ print $8}'` but line can containt more or less field in never know, i just know is the last one so i wondering to know if is... (3 Replies)
Discussion started by: kykyboss
3 Replies

2. Shell Programming and Scripting

select a particular field

hi i have a file wwww-qqq.eee ksdklfsdf adm,as.d,am sdsdlasdjl sadsadasda wwww-qqq.eee ksdklfsdf adm,as.d,am sdsdlasdjl sadsadasda wwww-qqq.eee ksdklfsdf adm,as.d,am sdsdlasdjl sadsadasda wwww-qqq.eee ksdklfsdf adm,as.d,am sdsdlasdjl sadsadasda wwww-qqq.eee ksdklfsdf adm,as.d,am... (4 Replies)
Discussion started by: Satyak
4 Replies

3. Shell Programming and Scripting

::select statement return value with correct field size::

Hi Everyone, I am facing a problem regarding the select from sybase, the return with the incorrect size. For example, field is NAME(20). After i selected from sybase, the result is nicky. after i assign it to another declaration variable, it will be in actual name "nicky" , what i need... (10 Replies)
Discussion started by: ryanW
10 Replies

4. Shell Programming and Scripting

How to select or make reference to, part of a field

For a field format such as AAL1001_MD82, how do I select(and use in if statement) only the last four elements( in this case MD82) or the first three elements (in this case AAL)? For instance, how do I do the following - if first three elements of $x == yyy, then ... (5 Replies)
Discussion started by: akshaykr2
5 Replies

5. Shell Programming and Scripting

awk, comma as field separator and text inside double quotes as a field.

Hi, all I need to get fields in a line that are separated by commas, some of the fields are enclosed with double quotes, and they are supposed to be treated as a single field even if there are commas inside the quotes. sample input: for this line, 5 fields are supposed to be extracted, they... (8 Replies)
Discussion started by: kevintse
8 Replies

6. Shell Programming and Scripting

AWK: Pattern match between 2 files, then compare a field in file1 as > or < field in file2

First, thanks for the help in previous posts... couldn't have gotten where I am now without it! So here is what I have, I use AWK to match $1 and $2 as 1 string in file1 to $1 and $2 as 1 string in file2. Now I'm wondering if I can extend this AWK command to incorporate the following: If $1... (4 Replies)
Discussion started by: right_coaster
4 Replies

7. Programming

Select and group by excluding one field

Dear community, I have a very simple query (on Oracle 11g) to select 3 fields: select field1, field2, field3, count(*) from table where... group by field1, field2, field3 having count(*) > 10;Now, what I need, is exclude "field3" from the "group by" since I only need field 1 and 2 to be... (2 Replies)
Discussion started by: Lord Spectre
2 Replies

8. Shell Programming and Scripting

How to select a particular field from a drop-down menu in a webpage using perl script?

Hi Team, I have a requirement to login into URL using username and password , then I have to select a "particular name" from drop-down menu and then Read the values user records etc.... using perl. Is it possible to do in perl script ? (OR) Can you please let me know which scripting... (1 Reply)
Discussion started by: latika
1 Replies

9. Shell Programming and Scripting

Select only the lines of a file starting with a field which is matcing a list. awk?

Hello I have a large file1 which has many events like "2014010420" and following lines under each event that start with text . It has this form: 2014010420 num --- --- num .... NTE num num --- num... EFA num num --- num ... LASW num num --- num... (9 Replies)
Discussion started by: phaethon
9 Replies

10. Shell Programming and Scripting

awk to adjust coordinates in field based on sequential numbers in another field

I am trying to output a tab-delimited result that uses the data from a tab-delimited file to combine and subtract specific lines. If $4 matches in each line then the first matching sequential $6 value is added to $2, unless the value is 1, then the original $2 is used (like in the case of line... (3 Replies)
Discussion started by: cmccabe
3 Replies
explain_printf(3)					     Library Functions Manual						 explain_printf(3)

NAME
explain_printf - explain printf(3) errors SYNOPSIS
#include <libexplain/printf.h> const char *explain_printf(const char *format); const char *explain_errno_printf(int errnum, const char *format); void explain_message_printf(char *message, int message_size, const char *format); void explain_message_errno_printf(char *message, int message_size, int errnum, const char *format); DESCRIPTION
These functions may be used to obtain explanations for errors returned by the printf(3) system call. explain_printf const char *explain_printf(const char *format); The explain_printf function is used to obtain an explanation of an error returned by the printf(3) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. format The original format, exactly as passed to the printf(3) system call. Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. Example: This function is intended to be used in a fashion similar to the following example: errno = 0; int result = printf(format); if (result < 0 && errno != 0) { fprintf(stderr, "%s ", explain_printf(format)); exit(EXIT_FAILURE); } The above code example is available pre-packaged as the explain_printf_or_die(3) function. explain_errno_printf const char *explain_errno_printf(int errnum, const char *format); The explain_errno_printf function is used to obtain an explanation of an error returned by the printf(3) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. format The original format, exactly as passed to the printf(3) system call. Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. Example: This function is intended to be used in a fashion similar to the following example: errno = 0; int result = printf(format); if (result < 0 && errno != 0) { int err = errno; fprintf(stderr, "%s ", explain_errno_printf(err, format)); exit(EXIT_FAILURE); } The above code example is available pre-packaged as the explain_printf_or_die(3) function. explain_message_printf void explain_message_printf(char *message, int message_size, const char *format); The explain_message_printf function is used to obtain an explanation of an error returned by the printf(3) system call. The least the mes- sage will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. message The location in which to store the returned message. If a suitable message return buffer is supplied, this function is thread safe. message_size The size in bytes of the location in which to store the returned message. format The original format, exactly as passed to the printf(3) system call. Example: This function is intended to be used in a fashion similar to the following example: errno = 0; int result = printf(format); if (result < 0 && errno != 0) { char message[3000]; explain_message_printf(message, sizeof(message), format); fprintf(stderr, "%s ", message); exit(EXIT_FAILURE); } The above code example is available pre-packaged as the explain_printf_or_die(3) function. explain_message_errno_printf void explain_message_errno_printf(char *message, int message_size, int errnum, const char *format); The explain_message_errno_printf function is used to obtain an explanation of an error returned by the printf(3) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. message The location in which to store the returned message. If a suitable message return buffer is supplied, this function is thread safe. message_size The size in bytes of the location in which to store the returned message. errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. format The original format, exactly as passed to the printf(3) system call. Example: This function is intended to be used in a fashion similar to the following example: errno = 0; int result = printf(format); if (result < 0 && errno != 0) { int err = errno; char message[3000]; explain_message_errno_printf(message, sizeof(message), err, format); fprintf(stderr, "%s ", message); exit(EXIT_FAILURE); } The above code example is available pre-packaged as the explain_printf_or_die(3) function. SEE ALSO
printf(3) formatted output conversion explain_printf_or_die(3) formatted output conversion and report errors COPYRIGHT
libexplain version 0.52 Copyright (C) 2010 Peter Miller explain_printf(3)
All times are GMT -4. The time now is 05:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy