Search Results

Search: Posts Made By: sajmar
4,931
Posted By senhia83
Either of these patches might work, although...
Either of these patches might work, although there are smarter ways

awk '{a[$2$3]++; b[$2$3]=$0}END{for(as in a) if(a[as]==1) print b[as]}' infile | sort -k2,2n

awk '{a[$2$3]++;...
4,931
Posted By senhia83
If order is not important awk '{a[$3]++;...
If order is not important

awk '{a[$3]++; b[$3]=$0}END{for(as in a) if(a[as]==1) print b[as]}' infile

M4 1 3456
M8 2 7889
M5 2 456
3,966
Posted By Corona688
shuf < inputfile | split -l 5000 sample. ...
shuf < inputfile | split -l 5000 sample.

This will create sample files sample.aa, sample.ab, sample.ac of 5000 randomly-chosen non repeating lines each.

I've used shuf on megabytes of data for...
3,966
Posted By Corona688
The linux shuf utility can select random lines...
The linux shuf utility can select random lines without repeats. Run it once and read three lines at a time from it in a loop.

shuf < inputfile | while read LINE1 && read LINE2 && read LINE3
do...
3,966
Posted By RavinderSingh13
Hello sajmar, Could you please try following...
Hello sajmar,

Could you please try following and let me know if this helps you.
1st solution:

cat script.ksh
lines_in_file=`cat Input_file | wc -l`
file=Input_file
for val in `seq 1 5000`; ...
3,599
Posted By RudiC
Tryawk 'FNR==NR {C[++j]=$1;next} {for...
Tryawk 'FNR==NR {C[++j]=$1;next} {for (i=1;i<=j;i++) printf "%s ", $C[i]; printf "\n"}' file2 file1
1 0 0
2 1 0
1 0 2
2 1 0
2,865
Posted By Scrutinizer
Your requirement is unclear to me. In the example...
Your requirement is unclear to me. In the example you gave there is no relation between column 2 and 3 in the output file..

---
*EDIT*
OK I see you have just edited your post #1 and now the...
4,780
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
4,345
Posted By Corona688
awk 'NR==1 { print > "M" ; print > "F"; next } ...
awk 'NR==1 { print > "M" ; print > "F"; next }
{ print > $4 }' inputfile
5,340
Posted By Chubler_XL
OK my mistake, try this: awk ' { V[NR]=$1...
OK my mistake, try this:

awk '
{ V[NR]=$1 }
END {
srand()
for(i=1;i<=1440;) {
v=V[int(1+rand()*7200)]
if (!(v in N)) {
N[v]
print v
i++
}
}
}'...
5,340
Posted By Chubler_XL
Here is a solution using awk. You didn't say...
Here is a solution using awk.

You didn't say column separator your file has - so I'm assuming it's a comma.

You can change the -F parameter according to you actual value, also note that some...
5,340
Posted By jim mcnamara
FWIW - "random" means any number in the range of...
FWIW - "random" means any number in the range of valid values can occur any time. By saying "random with no duplicates" is not the same thing. Do not use this for encryption.
Showing results 1 to 12 of 12

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