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
HTTP_BUILD_URL(3)							 1							 HTTP_BUILD_URL(3)

http_build_url - Build a URL

SYNOPSIS
string http_build_url ([mixed $url], [mixed $parts], [int $flags = HTTP_URL_REPLACE], [array &$new_url]) DESCRIPTION
Build a URL. The parts of the second URL will be merged into the first according to the flags argument. PARAMETERS
o $url - (part(s) of) a URL in form of a string or associative array like parse_url(3) returns o $parts - same as the first argument o $flags - a bitmask of binary or'ed HTTP_URL constants; HTTP_URL_REPLACE is the default o $new_url - if set, it will be filled with the parts of the composed url like parse_url(3) would return RETURN VALUES
Returns the new URL as string on success or FALSE on failure. EXAMPLES
Example #1 A http_build_url(3) example <?php echo http_build_url("http://user@www.example.com/pub/index.php?a=b#files", array( "scheme" => "ftp", "host" => "ftp.example.com", "path" => "files/current/", "query" => "a=c" ), HTTP_URL_STRIP_AUTH | HTTP_URL_JOIN_PATH | HTTP_URL_JOIN_QUERY | HTTP_URL_STRIP_FRAGMENT ); ?> The above example will output: ftp://ftp.example.com/pub/files/current/?a=c SEE ALSO
parse_url(3), http_build_str(3). PHP Documentation Group HTTP_BUILD_URL(3)
All times are GMT -4. The time now is 05:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy