Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Can someone please explain why we need to set ORS in below awk code? Post 303029053 by Scrutinizer on Sunday 20th of January 2019 02:19:38 AM
Old 01-20-2019
You're welcome. Yes I meant to write print "" , not print . I will correct it in my post..
One could also use: printf "\n" or printf ORS.

Last edited by Scrutinizer; 01-20-2019 at 03:25 AM..
This User Gave Thanks to Scrutinizer For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

could someone explain this code

hey peeps could someone explain what this part of the code means: 'if echo $* | grep -q' $i '|| thanks tHe_nEw_GuY (2 Replies)
Discussion started by: the_new_guy
2 Replies

2. Shell Programming and Scripting

rs and ors in gawk ...????

:D dear members I have a good knowledge of gawk and seem to do quite well with it.. but I have never understood what the use of the rs and ors are for or how they are used.. i am thinking they are for seperating lines and paragraphs but i have absolutely no idea how to make it work, if that is what... (2 Replies)
Discussion started by: moxxx68
2 Replies

3. UNIX for Advanced & Expert Users

explain the code

Hi , Can anyone explains what does the below highlighted statements means: # Set environment variables . ${0%/*}/wrkenv.sh jobName_sh=${0##*/} jobName=${jobName_sh%.*} Thanks, Sri (1 Reply)
Discussion started by: srilaxmi
1 Replies

4. Shell Programming and Scripting

Can any one explain what this code will do

ccc_con,CCC_CON,0 Above is the input for this code #!/usr/bin/bash my_path=`dirname $0` T_table=$1 S_table=$2 P_table=$3 #Star new code while read ${my_path}/arch_table_list.txt { awk -F "," '{print $1}' ${my_path}/arch_table_list.txt ${S_table} awk -F "," '{print... (1 Reply)
Discussion started by: scorp_rahul23
1 Replies

5. Shell Programming and Scripting

Please explain what this code is doing

Hi, Pls explain me what the below code is doing. specially meaning if -a while calling test function- case $1 in 1) beg_dt=01; end_dt=07 ;; 2) beg_dt=08; end_dt=14 ;; 3) beg_dt=15; end_dt=21 ;; 4) beg_dt=22; end_dt=28 ;; 5) beg_dt=29; end_dt=31 ;; esac test \( `date +%w` -eq $2 -a... (3 Replies)
Discussion started by: sendtoshailesh
3 Replies

6. Programming

SET EXPLAIN ON

Hi, I'm working on INFORMIX4GL, i'm just trying to find out the missing indexes in my db. I think SET EXPLAIN ON would give me some hint on this Do anyone know how to use this? Thanks (1 Reply)
Discussion started by: dvah
1 Replies

7. Shell Programming and Scripting

Please explain what this Awk code is doing

Hi Guys, Please help me, I am new to programming and I don’t understand what some parts of this code are doing. I have comments on the parts I know, please help if my understanding of the code is not correct and also help with parts with questions. awk ' { gsub( ">",... (1 Reply)
Discussion started by: James_Owen
1 Replies

8. UNIX for Dummies Questions & Answers

awk code to process column pairs and find those with more than 1 set of possible values

Hi, I have a very wide dataset with pairs of columns starting from column 7 onwards (see example below). 0 123456 -1 0 0 -9 0 0 1 2 2 2 1 1 1 1 2 2... 0 123457 -1 0 0 -9 1 2 1 1 2 2 0 0 0 0 2 2... 0 123458 -1 0 0 -9 0 0 1 2 2 2 1 1 2 2 1 2... 0 123459 -1 0 0 -9 1 2 0 0 2 2 1 1 1 2 1 1...... (2 Replies)
Discussion started by: kasan0
2 Replies

9. Shell Programming and Scripting

awk RS/ORS error

Hello, I am trying to filter fastq file (in short, every 4 lines to be a record) based on the GC counts (GC-contents) in sequence (i.e. field 2), which is the count % of the G/C chars in the string. The example script is to pick up records with GC contents > 0.6 in the sequence (second field). ... (9 Replies)
Discussion started by: yifangt
9 Replies

10. Shell Programming and Scripting

awk : ORS not to be printed after the last record

Hello Team, here is the code: scripts]# ls /etc/init.d/ | awk 'BEGIN{ORS=" && "} /was.init/ && !/interdependentwas/ && !/NodeAgent/ && !/dmgr/{print "\$\{service_cmd\} "$0 " status"}' 2>/dev/null ${service_cmd} cmserver_was.init status && ${service_cmd} fmserver_was.init status &&... (6 Replies)
Discussion started by: chandana.hs
6 Replies
PRINTF(9)						   BSD Kernel Developer's Manual						 PRINTF(9)

NAME
printf, uprintf, tprintf, log -- formatted output conversion SYNOPSIS
#include <sys/types.h> #include <sys/systm.h> int printf(const char *fmt, ...); void tprintf(struct proc *p, int pri, const char *fmt, ...); int uprintf(const char *fmt, ...); #include <sys/syslog.h> void log(int pri, const char *fmt, ...); DESCRIPTION
The printf(9) family of functions are similar to the printf(3) family of functions. The different functions each use a different output stream. The uprintf() function outputs to the current process' controlling tty, while printf() writes to the console as well as to the log- ging facility. The tprintf() function outputs to the tty associated with the process p and the logging facility if pri is not -1. The log() function sends the message to the kernel logging facility, using the log level as indicated by pri. Each of these related functions use the fmt parameter in the same manner as printf(3). However, printf(9) adds two other conversion speci- fiers. The %b identifier expects two arguments: an int and a char *. These are used as a register value and a print mask for decoding bitmasks. The print mask is made up of two parts: the base and the arguments. The base value is the output base expressed as an integer value; for example, 10 gives octal and 20 gives hexadecimal. The arguments are made up of a sequence of bit identifiers. Each bit identifier begins with an integer value which is the number of the bit (starting from 1) this identifier describes. The rest of the identifier is a string of characters containing the name of the bit. The string is terminated by either the bit number at the start of the next bit identifier or NUL for the last bit identifier. The %D identifier is meant to assist in hexdumps. It requires two arguments: a u_char * pointer and a char * string. The memory pointed to be the pointer is output in hexadecimal one byte at a time. The string is used as a delimiter between individual bytes. If present, a width directive will specify the number of bytes to display. By default, 16 bytes of data are output. The log() function uses syslog(3) level values LOG_DEBUG through LOG_EMERG for its pri parameter (mistakenly called 'priority' here). Alter- natively, if a pri of -1 is given, the message will be appended to the last log message started by a previous call to log(). As these mes- sages are generated by the kernel itself, the facility will always be LOG_KERN. RETURN VALUES
The printf() and the uprintf() functions return the number of characters displayed. EXAMPLES
This example demonstrates the use of the %b and %D conversion specifiers. The function void printf_test(void) { printf("reg=%b ", 3, "102BITTWO1BITONE"); printf("out: %4D ", "AAAA", ":"); } will produce the following output: reg=3<BITTWO,BITONE> out: 41:41:41:41 The call log(LOG_DEBUG, "%s%d: been there. ", sc->sc_name, sc->sc_unit); will add the appropriate debug message at priority ``kern.debug'' to the system log. SEE ALSO
printf(3), syslog(3) BSD
September 8, 2006 BSD
All times are GMT -4. The time now is 02:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy