Search Results

Search: Posts Made By: sxiong
1,282
Posted By cjcox
You have a tuple (2 items) where each is an...
You have a tuple (2 items) where each is an array.

So you can loop through one of the tuple arrays for its length and just use a simple incrementing counter to output that index in each array.

...
284,298
Posted By Neo
Simple rules of the UNIX.COM forums:
RULES OF THE UNIX AND LINUX FORUMS

For the latest version of the community rules (the official community rules page), please visit here. (https://www.unix.com/misc.php?do=cfrules)


No flames,...
1,129
Posted By junior-helper
Try this: while read number; do sed -n...
Try this:
while read number; do
sed -n ${number}p file1
done < file2
1,129
Posted By Ditto
Simple method might be something like: ...
Simple method might be something like:


for i in `cat $file2`
do
head -$i $file1 | tail -1
done


not sure if there's a cleaner or more efficient way, though :)
1,129
Posted By sea
Hi Have you tried while read N;do grep -n...
Hi

Have you tried while read N;do grep -n ^$N *spec;done<list.txt yet?

hth
1,129
Posted By senhia83
Try sed 's/^/NR==/' linesfile | awk -f -...
Try

sed 's/^/NR==/' linesfile | awk -f - datafile
1,129
Posted By Scrutinizer
Try: awk 'NR==FNR{A[$1]; next} FNR in A' file2...
Try:
awk 'NR==FNR{A[$1]; next} FNR in A' file2 file1
1,877
Posted By RudiC
Please use code tags as required by forum rules! ...
Please use code tags as required by forum rules!

How aboutawk '{print a<500,a++,$1/(a*1.121212121212121229e-02)}' OFMT="%.16g" file
1 0 963.7404552836596
1 1 474.1229450561879
1 2...
1,877
Posted By RudiC
I'm pretty sure your construct...
I'm pretty sure your construct (a<500,a++,$1/(a*1.1212121212121229e-02)) is not understood by awk. What be your intention?
1,877
Posted By Don Cragun
Please explain in English what this awk script is...
Please explain in English what this awk script is supposed to do. I can make a few wild guesses, but none of them make any sense to me.

Then note that awk uses double precision floating point...
1,877
Posted By MadeInGermany
Print two integers and one floating point? awk...
Print two integers and one floating point?
awk '{printf "%d %d %.16f\n",(a<500),a++,$1/(a*1.121212121212121229e-02)}' input.datYou get exponential notation if you change f to e.
790
Posted By Yoda
Use awk -v option for variable assignment and use...
Use awk -v option for variable assignment and use that variable instead:
awk -v I="$i" '{r=sqrt($2^2+$3^2+$4^2); if(r<=I) print r }' input.txt
1,551
Posted By in2nix4life
awk '{for(a=0;a<$1;a++) print $2}' infile
awk '{for(a=0;a<$1;a++) print $2}' infile
Showing results 1 to 13 of 13

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