Search Results

Search: Posts Made By: dovah
8,857
Posted By Yoda
Try:- awk -F'\t' 'FNR==1{ofile="NEW"...
Try:-
awk -F'\t' 'FNR==1{ofile="NEW" FILENAME}$10=="S"{print > ofile}' *.subVCF
3,021
Posted By RudiC
Would this come close: awk 'FNR==NR {T[$1]=$3 FS...
Would this come close: awk 'FNR==NR {T[$1]=$3 FS $4; next} {print $0, T[$1]}' file2 file1
#file1-header1
file1-header2
111 qwe rtz uio
198 asd fgh jkl nko1 vhu1
165 yxc...
1,479
Posted By MadeInGermany
If the pattern is always 4 characters then you...
If the pattern is always 4 characters then you can replace the loop
{for (t in T) if ($2 ~ t) $(NF+1)=T[t]}
1by the efficient
{print $0, T[substr($2,1,4)]}
1,479
Posted By RudiC
Well, try awk ' FNR==NR {X=$1 ...
Well, try awk '
FNR==NR {X=$1
sub ($1 FS, "")
T[X]=$0
next
}
{for (t in T) if ($2 ~ t) $(NF+1)=T[t]}...
4,128
Posted By RudiC
You forgot to mention which OS and shell you are...
You forgot to mention which OS and shell you are using. With bourne type shells, this might work:ls *.geno | while read FN; do awk -f example.awk $FN final.map > ${FN/geno/dat}; done
1,489
Posted By Scrutinizer
You were on the right track. Here is an approach...
You were on the right track. Here is an approach with two-dimensional arrays :
awk '{split($2,F,/,/)} NR==FNR{for(i in F) A[$1,F[i]]; next} {for(i in F) if(($1,F[i]) in A) $3=$3 "*"}1' FS='\t'...
11,523
Posted By Scrutinizer
If there is maximum of 1 entry per file: awk...
If there is maximum of 1 entry per file:
awk '++A[$0]>=ARGC-1' file*

This would then be a bit more robust:
awk '{$1=$1} ++A[$0]>=ARGC-1' file*

But 1000 files is probably going to be too many...
33,439
Posted By Scrutinizer
awk -F, '{gsub(/"[^"]*"/,x);print...
awk -F, '{gsub(/"[^"]*"/,x);print NF}'
33,439
Posted By machomaddy
Count number of column in a comma delimited file
I have a comma (,) delimited file.

106232145,"medicare","medicare,medicaid",789


I would like to count the number of fields in each line.
I tried the below code

awk -F ',' '{print NF-1}'...
Showing results 1 to 9 of 9

 
All times are GMT -4. The time now is 04:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy