while using following awk commend I’m getting confused,
The output is not like as the row present in input files, can anyone explain and tell me how to print in the order like in input.
File1.tsv
File2.tsv
Result file.tsv
Last edited by Don Cragun; 06-20-2013 at 05:35 AM..
Reason: Fixed CODE tag for code segment.
As the order in which array elements are retrieved in a (for i in arr) command is undefined (c.f. awk man page), there's not much you can do. One option might be to use sequence numbers as indexes into the array, and then print according to that sequence.
BTW, the result that you present is not the result of your command line applied to the sample files as posted.
And also your awk seems to be doing things only with file1.tsv. What would you really require to do with both files ? If you want to preserve order, it is better to print them as it gets processed than using array indexes.
1st I'm matching the file1.tsv 2nd col value to file2.tsv then take
the average of the 4th col with the corresponding value of col2,
that so I'm printing 2sd col value and result value , but the printed flow is changing
---------- Post updated at 03:22 PM ---------- Previous update was at 03:10 PM ----------
Yes rudic, the result of above is,
this can be get only after removed the next word
Hello
I am working on one script where I am trying to display all the directories which is inside the workspace but somehow it is giving me weird output and this is occurring only with one directory other also having the result.html file inside the directory.
for i in `ls -1 | egrep -iv... (2 Replies)
Hi,
I want to print the item in reverse order such that the output would look like
00 50 50 23 40 22 02 96
Below is the input:
00 05 05 32 04 22 20 69
Video tutorial on how to use code tags in The UNIX and Linux Forums. (5 Replies)
Dear help!
I want to print
The number i is number i
let i=1 to 5
output
should be like
The number 1 is number 1
The number 2 is number 2
The number 3 is number 3
The number 4 is number 4
The number 5 is number 5
Would be gr8 if you mke this with awk
Thanks (7 Replies)
I'm asking for explanation about the output of the diff format when i compare the two files f1 and f2:
root@host1 # cat f1
205226
205237
205250
205255
205262
205274
205307
205403
205464
205477
205500
205520
205626
205759
205766
205776 (2 Replies)
Hello,
I am trying to print line number/order using this command
awk '{print $0, FNR}' myfilename
11006 A41 1888
11006 A41 1888
11006 A41 1888
11006 A41 ... (2 Replies)
My shell script below for import data to Oracle
it run okay. but the text display not correct follow order command executed.
=========================Shell Script code=================
#!/bin/sh
#directory = ${1-'pwd'}
#run import data with SQLLoader
runSQLLoader()
{
... (2 Replies)