Sponsored Content
Top Forums Shell Programming and Scripting write a matrix element, if the "if" condition satisfies Post 302692885 by Fredrick on Tuesday 28th of August 2012 07:49:50 AM
Old 08-28-2012
Thanks Rudi, the following code works fine.

Code:
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 differences?
Thanks in advance.
Warm regards

[@elixir - Thanks, Yes I need absolute differences]
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

communicating wth another user aside from "wall" and "write"

Hi, Can anyone suggest a Unix command or c-shell algorithm to simulate to behavior of "wall" command minus the "all users"? What I'm trying to do is to send a notice to just one particular user but i dont want other remotely-logged-on users to receive the message (on the pseudo-terminals). I... (6 Replies)
Discussion started by: Deanne
6 Replies

2. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

3. Shell Programming and Scripting

acessing awk array element while getline < "file"

I am attempting to write a awk script that reads in a file after awk array elements are assigned and using those elements while reading in the new file. Does this make sense? /pattern/ {tst=$3} (( getline < "file" ) > 0 ) { x=x " "tst } When I print tst in the END statement it... (9 Replies)
Discussion started by: timj123
9 Replies

4. Shell Programming and Scripting

Error to "find" a matching array element in a directory

Hi, I have defined an array which holds a couple of elements which are nothing but files names. I want to find the files in a directory for the matching file name(array elements) with less than 1 day old. When I am trying to execute the code (as below), it gives an error. Your help in this... (1 Reply)
Discussion started by: mkbaral
1 Replies

5. Shell Programming and Scripting

Perl Foreach add "4" to the end of each element

I wrote the following script configuring cisco router:#!/usr/bin/perl use strict; use warnings; use Getopt::Long; use Opsware::NAS::Connect; my @IP = split(/\./,"$tc_device_ip$"); my $O3 = $IP; my($host, $port, $user, $pass) =... (3 Replies)
Discussion started by: ahmed_zaher
3 Replies

6. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

7. Shell Programming and Scripting

Problems with "write" and "wall"

Hello, I am using VirtualBox to simulate a small network with two Linux computers, the host is Mac OS X. My problem is that I can't send "write" and "wall" messages from the host to one of those Linux computers. Here is what works: - The virtual Linux computer answers "ping" messages that have... (5 Replies)
Discussion started by: 123_abc
5 Replies

8. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

9. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
mlib_VectorSumAbsDiff_U8_Sat(3MLIB)			    mediaLib Library Functions			       mlib_VectorSumAbsDiff_U8_Sat(3MLIB)

NAME
mlib_VectorSumAbsDiff_U8_Sat, mlib_VectorSumAbsDiff_S8_Sat, mlib_VectorSumAbsDiff_S16_Sat, mlib_VectorSumAbsDiff_S32_Sat - sum of the abso- lute values of the differences of two vectors SYNOPSIS
cc [ flag... ] file... -lmlib [ library... ] #include <mlib.h> mlib_status mlib_VectorSumAbsDiff_U8_Sat(mlib_d64 *z, const mlib_u8 *x, const mlib_u8 *y, mlib_s32 n); mlib_status mlib_VectorSumAbsDiff_S8_Sat(mlib_d64 *z, const mlib_s8 *x, const mlib_s8 *y, mlib_s32 n); mlib_status mlib_VectorSumAbsDiff_S16_Sat(mlib_d64 *z, const mlib_s16 *x, const mlib_s16 *y, mlib_s32 n); mlib_status mlib_VectorSumAbsDiff_S32_Sat(mlib_d64 *z, const mlib_s32 *x, const mlib_s32 *y, mlib_s32 n); DESCRIPTION
Each of these functions computes the sum of the absolute values of the differences of two vectors. The following equation is used: n-1 z[0] = SUM |x[i] - y[i]| i=0 PARAMETERS
Each of the functions takes the following arguments: z Pointer to the sum of the absolute differences between two vectors. x Pointer to the first element of the first source vector. y Pointer to the first element of the second source vector. n Number of elements in the vectors. RETURN VALUES
Each of the functions returns MLIB_SUCCESS if successful. Otherwise it returns MLIB_FAILURE. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5) SunOS 5.11 2 Mar 2007 mlib_VectorSumAbsDiff_U8_Sat(3MLIB)
All times are GMT -4. The time now is 11:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy