Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Can someone please explain why we need to set ORS in below awk code? Post 303029052 by Tanu on Sunday 20th of January 2019 02:13:59 AM
Old 01-20-2019
@Scrutinizer that explains the code well. Thank you very much Smilie



and I think we also need a \n for expected output Smilie

Code:
awk '{for(i=NF;i>0;i--) printf "%s  ",$i; print "\n"}'

This User Gave Thanks to Tanu 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
URLCODING(3)						 libbash urlcoding Library Manual					      URLCODING(3)

NAME
urlcoding -- a Libbash library for encoding and decoding URL's. SYNOPSIS
urlEncodeString [-l] <STRING> urlEncodeFile [-l] <FILE> urlEncodeStream [-l] urlDecodeString <STRING> urlDecodeFile <FILENAME> urlDecodeStream DESCRIPTION
urlcoding is a collection of functions that convert ASCII-text to standard URL's and vice-versa. The AWK code used is based on code by Heiner Steven <heiner.steven@odn.de> The function list: urlEncodeString Creates a URL from an ASCII string urlEncodeFile Converts a file into URL-valid text urlEncodeStream Converts standard input into URL-valid text urlDecodeString Converts a URL-encoded text back to a plain-text form urlDecodeFile Coverts URL-encoded text in a file back to plain text urlDecodeStream Converts URL-encoded standard input to text Detailed interface description follows. The [-l] option for the encoding functions should be used when line-feed characters (' ') are to be encoded as well. All functions print the results of their conversions to standard output. The exit status of all functions is that of the command 'awk', with '0' for success FUNCTIONS DESCRIPTIONS
urlEncodeString [-l] <STRING> Converts STRING - a string of ASCII characters - to URL. urlEncodeFile [-l] <FILE> Coverts FILE of URL-encoded text to plain text urlEncodeStream [-l] Converts text from standard input to URL-text. urlDecodeString <STRING> Converts URL-encoded string STRING back to text. urlDecodeFile <FILENAME> Converts the URL-encoded text in FILE to plain text. urlDecodeStream Converts the URL-encoded text from standard input to plain-text AUTHORS
Alon Keren <alon.keren@gmail.com> SEE ALSO
ldbash(1), libbash(1) Linux Epoch Linux
All times are GMT -4. The time now is 05:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy