I'm dealing with a bash script to merge the elements of a set of files and counting how many times each element is present. The last field is the file name.
Sample files:
==> 3J373_P15Ac1y2_01_LS.tab <==
==> 7D300_P15Ac1y2_01_GATK.tab <==
Up to several dozens of files...
Here is my code:
Output file:
I can create the index and count the lines. However I can't figure out how to append the file names into the $7 column.
I guess I have to replace "$7" with an array in the awk statement, but this is too much for me.
I really appreciate any help.
Thank you in advance
Last edited by Scrutinizer; 04-11-2014 at 08:40 AM..
Reason: Additional code tags
Hi,
Please can someone help to return the array elements from a function. Currently the problem I face is that tempValue stores the value in myValue as a string while I need an array of values to be returned instead of string.
Many Thanks,
Sudhakar
the function called is:
... (5 Replies)
hey champs,
i have variable as field_dtls,
which has values like
CLIENT ID|FAMILY NAME|MIDDLE NAME|FIRST NAME|COUNTRY NAME|ADDRESS|NATIONAL ID|PASSPORT NUMBER
so,
echo "$field_dtls"
CLIENT ID|FAMILY NAME|MIDDLE NAME|FIRST NAME|COUNTRY NAME|ADDRESS|NATIONAL ID|PASSPORT NUMBER
but i... (2 Replies)
How do I access one of the indices in array tst with the code below?
tst=sprintf("%5.2f",Car / 12)
When I scan thru the array with
for ( i in tst ) { print i,tst }
I get the output of:
vec-7 144
But when I try this in the END
print tst
It looks like it's not set.
What am... (6 Replies)
Hi,
can I use array elements ( all ) in conditional statements?
the problem is ,the total number of elements is not known.
e.g
A is an array with elements - 1,2,3
now if i want to test if the 1 st field of input record is either 1,2 or 3, i can do something like this
if ( $1 ~... (1 Reply)
i have an array call ignore. it is set up
ignore=34th56
ignore=re45ty
ignore=rt45yu
.
.
ignore=rthg34
n is a variable. I have another variable that i read from a different file. It is $2 and it is working the way i expect. array ignore read and print correct values.
in the below if... (2 Replies)
i just want to dump my array and see if it contains the values i am expecting. It should print as follows,
ignore=345fht
ignore=rthfg56
.
.
.
ignore=49568g
Here is the code. Is this even possible to do? please help
termReport.pl < $4 | dos2ux | head -2000 | awk '
BEGIN... (0 Replies)
Hello,
I have two files in the following format;
file1:
A B C D
E F G H
I J K L
file2:
1 2 3 4
5 6 7 8
9 10 11 12
I have read them both in to multi-dimensional arrays. I need a file that has column 2 of the first file printed out for each column 3 of the second file ie...
... (3 Replies)
for a in {1..100}
do
awk '{ sum+=$a} END {print sum}' a=$a file1 > file2
done
I know I will get only one number if following the code above, how can I get 100 sum numbers in file2? (2 Replies)
Hi All,
need help with reading the array and sum of the array elements.
given an array of integers of size N . You need to print the sum of the elements in the array, keeping in mind that some of those integers may be quite large.
Input Format
The first line of the input consists of an... (1 Reply)