Search Results

Search: Posts Made By: dovah
11,662
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...
8,982
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
4,208
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
3,088
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,511
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,511
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]}...
33,635
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}'...
33,635
Posted By Scrutinizer
awk -F, '{gsub(/"[^"]*"/,x);print...
awk -F, '{gsub(/"[^"]*"/,x);print NF}'
1,557
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'...
Showing results 1 to 9 of 9

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