Search Results

Search: Posts Made By: Fredrick
8,975
Posted By Fredrick
Hi Scott, Thanks for your reply. As I am...
Hi Scott,

Thanks for your reply. As I am having my input as angles in the range of -180 to 180 in degrees, how can I convert this angle in to x and y? Since atan2() function will be taken in the...
8,975
Posted By Fredrick
Atan2 function in awk
Hello All,

I need your help in the following situation. I have a 100x100 matrix with angle values ranging from -180 to 180. I would like to calculate the atan2 values for the above mentioned...
3,984
Posted By Fredrick
Here is my input file (first few line only., it...
Here is my input file (first few line only., it has more than 500 lines)


Average 10 15 20 25 30 35 40 45
13.622 25 16 14 8 7 6 4 4
12.695 15 9 7 6...
3,984
Posted By Fredrick
awk '{for(i=2; i<=NF; i++) {if($i > 5 && $(i+1) <...
awk '{for(i=2; i<=NF; i++) {if($i > 5 && $(i+1) < 5) print $1=(i*5); else print ""}}' inputfile > outputfile


Yes the above-code print i*5; instead of that I would like to print only the header...
3,984
Posted By Fredrick
Sorry, Could you please explain me.
Sorry, Could you please explain me.
3,984
Posted By Fredrick
If condition satisfies print the column header
Dear All,

Good Day. I would like to solve the following issue and got some strange results, if anyone could help me in this regard, you are most welcome.

Here is the problem:

I have a file...
1,262
Posted By Fredrick
Print each column 3 times
Hi All,

I have a file with more than 2000 columns and I would like to print each column 3 times, so that I will get a file like col1 col1 col1 col2 col2 col2 ........coln coln coln.

I have...
Forum: Programming 10-19-2012
3,628
Posted By Fredrick
Matrix addition - Perl - PDL
Hi All,

I have a question. I need to add 3 matrices of size 2000 x 2000. (i.e) 2000 rows and 2000 columns using Perl::PDL module. I used the following perl script

#!/usr/bin/perl -w
use...
1,392
Posted By Fredrick
Hi Rudi, Thanks for the reply, since my...
Hi Rudi,

Thanks for the reply, since my input is having 1000 rows, i pasted only first few lines.

-Fredrick.
1,392
Posted By Fredrick
Hi Rudi, Thanks for your reply. I just tried...
Hi Rudi,

Thanks for your reply. I just tried with only two columns (for testing). here is the input:


1 2
2 3
3 3
4 3
5 3
6 3
7 2
8 3
...
1,392
Posted By Fredrick
column to matrix
Hello All,

I need your help in the following problem. I have a matrix of 500 columns and 1000 rows and in each cell, it is having a value range from 0 to 9. I would like to convert each column in...
2,642
Posted By Fredrick
Thanks Rudi, the following code works fine. ...
Thanks Rudi, the following code works fine.


awk '{for (i=2;i<=NF;i++) if (($i-$1)>2 && $i-$(i-1)>2) print "line ", NR, ", field ", i}' infile

How can I change the code, if i need an absolute...
2,642
Posted By Fredrick
Thanks elixir sinari, The output should be the...
Thanks elixir sinari, The output should be the number., like [1,2] or [4,5]..etc. It should be the matrix element number.

---------- Post updated at 01:28 PM ---------- Previous update was at...
2,642
Posted By Fredrick
Hi Pamu, Thanks for your reply. But...
Hi Pamu,

Thanks for your reply.

But the problem here is, irrespective of the value in the condition, I need to write the matrix element (that means, the row and column number) in the output...
2,642
Posted By Fredrick
write a matrix element, if the "if" condition satisfies
Hi All,

I would like to check a condition in a nxm matrix and if the condition satisfies then, I need to write the matrix element in the output file.

For example, I have a matrix like this:
1...
2,065
Posted By Fredrick
awk & if loop
Dear All,

I have a file with 1s and 0s with tab delimited file of approximately 535 lines and 1000 columns. I would like to print the lines, which are having 1s in it and i don't want to print the...
2,608
Posted By Fredrick
Thank you ahmad.diab and pludi., its working...
Thank you ahmad.diab and pludi., its working fine.

warm regards
Fredrick.

---------- Post updated at 01:36 PM ---------- Previous update was at 09:57 AM ----------

Hi All,

To continue...
26,151
Posted By Fredrick
Hello All, Thank you very much for your...
Hello All,

Thank you very much for your replies. Its working fine.

In addition to the above query, I would like to extend the same from 'n' columns. That is, I have a file with 100 lines with...
1,240
Posted By Fredrick
Thank you very much for your reply cmf1985. Its...
Thank you very much for your reply cmf1985. Its working fine.

Warm regards
Fredrick.
2,608
Posted By Fredrick
Hi Pludi, Thank you very much for your...
Hi Pludi,

Thank you very much for your reply. I have tried the following code:

#!/usr/bin/perl -W

use strict;
use warnings;

while ( my $line = <DATA> ) {
my @cols = split / /,...
2,608
Posted By Fredrick
Subtracting columns against each other
Hi All,

I have a file of 100 lines of each having 1000 columns. I need to find the difference of each column against each other. That means, Col1-Col1; Col1-Col2; Col1-Col3;......Col1-Col1000;...
26,151
Posted By Fredrick
How to subtract the adjacent lines from a single column?
Hi All,

I have a file with only one column and i need to subtract the adjacent lines of the same column and print it in the same column.

For Example:
(Input)
Col1

5
10
12
6
9
12
5...
7,750
Posted By Fredrick
range in if using awk
Hi All,

I would like to assign the following values to each column in my file.

if $i is between 1 and -1 (ie -1 < $i < 1) then print A;
if $i is between -2 and -1 && 1 and 2 (ie. -2 < $i < -1...
74,020
Posted By Fredrick
Thank you very much "cfajohnson", the following...
Thank you very much "cfajohnson", the following code is working perfect.

file=/path/to/file
delimiter=' '
cut -d "$delimiter" -f 1-100 "$file"

---------- Post updated at 11:22 AM ----------...
74,020
Posted By Fredrick
How to print first 'n' columns?
Hello All,

I have a file of 1000 columns. I need to print only the first 100 columns in to a new file. I have tried with the following code

awk -F '{ for(i=0; i<=100; i++) {printf $i}'...
Showing results 1 to 25 of 43

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