Search Results

Search: Posts Made By: hubleo
12,677
Posted By bartus11
You can put a newline like this:awk 'NR==FNR{ ...
You can put a newline like this:awk 'NR==FNR{
a[NR]=$0;next}{for (i in a){split(a[i],x," ");if (x[4]==$2&&x[2]>=$3&&x[3]<=$4)print $0,x[1],x[2],x[3]}}' file2 file1
12,677
Posted By bartus11
Try:awk 'NR==FNR{a[NR]=$0;next}{for (i in...
Try:awk 'NR==FNR{a[NR]=$0;next}{for (i in a){split(a[i],x," ");if (x[4]==$2&&x[2]>=$3&&x[3]<=$4)print $0,x[1],x[2],x[3]}}' file2 file1
1,351
Posted By balajesuri
join -a1 -o0 1.2 1.3 2.2 -e0 file1 file2
join -a1 -o0 1.2 1.3 2.2 -e0 file1 file2
1,351
Posted By pamu
awk 'NR==FNR{A[$1]=$2;next}{if(A[$1]){print...
awk 'NR==FNR{A[$1]=$2;next}{if(A[$1]){print $0,A[$1]}else{print $0,"0"}}' file2 file1
2,218
Posted By Don Cragun
I don't have a set of files of the size you want...
I don't have a set of files of the size you want to use, but the following works for the samples you provided:
awk '
FNR == NR {
h[$1] = NR # set "h"igh end of input lines for this...
2,218
Posted By Don Cragun
I understand that file 1 is not sorted and that...
I understand that file 1 is not sorted and that doesn't matter to me. Lines from file 1 can be read and processed without having to store file 1 values.

File 2 values, however, need to be stored...
1,283
Posted By franzpizzo
Hi, the error is the nested loops: try this way ...
Hi, the error is the nested loops: try this way

END=4
for ((i=1;i<=END;i++))
do
N=`sed -n ${i}p variable.txt`
mv ${i}.txt ${N}.txt
done
1,237
Posted By Chubler_XL
Not sure if you want to do anything else with j...
Not sure if you want to do anything else with j in your actual code, but in every case j is i+10 or (i+6000 in your full example), so you could just use:

for ((i=1;i<=END;i++))
do
echo...
1,237
Posted By Jotne
awk 'BEGIN {for (i=1000; i<=6000; i++) print...
awk 'BEGIN {for (i=1000; i<=6000; i++) print i"_"i+6000".txt"}'
1,237
Posted By Yoda
Here is a bash script: #!/bin/bash i=1 ...
Here is a bash script:
#!/bin/bash

i=1
j=11

while :
do
if [ $i -gt 5 ] || [ $j -gt 15 ]
then
break
fi

echo "${i}_${j}"

i=$((...
1,894
Posted By clx
The "i" variable in my post is the awk variable...
The "i" variable in my post is the awk variable and has nothing to do the shell (for loop). If you have files-names in an array, you can use like this

awk 'FNR==1 {i++} {print $0 FS i >...
5,277
Posted By jim mcnamara
awk '{ max[$3]=($2>max[$3])? $2: max[$3]; ...
awk '{ max[$3]=($2>max[$3])? $2: max[$3];
if(! $3 in min) {min[$3]=999999999};
min[$3]=($1<min[$3])? $1: min[$3];
next;
}
END {
...
Showing results 1 to 12 of 12

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