Sponsored Content
Top Forums UNIX for Dummies Questions & Answers What is the difference in this two awk command? Post 302974226 by later_troy on Thursday 26th of May 2016 03:50:20 PM
Old 05-26-2016
Wonderful !!! Thanks for examples.
 

10 More Discussions You Might Find Interesting

1. AIX

difference between ls -b and ls command

hi anyone please tell me what is the difference between ls -b command and ls command. (1 Reply)
Discussion started by: sathish2win
1 Replies

2. Programming

Difference between cp and mv linux command

Hi, I am facing one problem only with mv command not with cp command. I have a test program #include <stdio.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/mount.h> #include <fcntl.h> #include <errno.h> int sync_file(char *file) { FILE *fp=NULL;... (6 Replies)
Discussion started by: dharshini123
6 Replies

3. Shell Programming and Scripting

awk command in script gives error while same awk command at prompt runs fine: Why?

Hello all, Here is what my bash script does: sums number columns, saves the tot in new column, outputs if tot >= threshold val: > cat getnon0file.sh #!/bin/bash this="getnon0file.sh" USAGE=$this" InFile="xyz.38" Min="0.05" # awk '{sum=0; for(n=2; n<=NF; n++){sum+=$n};... (4 Replies)
Discussion started by: catalys
4 Replies

4. UNIX for Dummies Questions & Answers

which command difference

What is the difference between (unix-system “which ) and which commands. For example when I use the (unix-system “which visual_elite) command I get the following result: /home/vhdl/edatools/mentor/visualelite/VisualElite-4.2.1/Linux2.4/bin/visual_elite When I do the same on... (1 Reply)
Discussion started by: mihaelab
1 Replies

5. Shell Programming and Scripting

AWK Script and Commandline difference

Hey there, I just stumbled upon a difference between using awk on the commandline and using it in a shellscript. I have a variable, e.g.: PROG=vim then i want to check if the package with this name is installed: TEMPVAL=$(dpkg -l | awk '{ if ($2 == "$PROG") print $2 }') (Im using... (10 Replies)
Discussion started by: MrSnail
10 Replies

6. UNIX for Dummies Questions & Answers

command difference - find

Hi, What is the difference between these two? find /some_dir -type f -exec chmod 070 {} \; and chmod 070 `find /some_dir -type f` Thanks (5 Replies)
Discussion started by: lamont
5 Replies

7. Shell Programming and Scripting

Simple awk command to compare two files and print first difference

Hello, I have two text files, each with a single column, file 1: 124152970 123899868 123476854 54258288 123117283 file 2: 124152970 123899868 54258288 123117283 122108330 (5 Replies)
Discussion started by: LMHmedchem
5 Replies

8. Shell Programming and Scripting

Awk: What is the difference between: X[a,b,c] - X[a][b,c] - X[a][b][c]

I have awk appearing to behave inconsistently. With the same variable it will give the message: fatal: attempt to use array `X' in a scalar context and, if I try to correct that, then: fatal: attempt to use a scalar value as array I'm using a three dimensional array. There seems to be a... (2 Replies)
Discussion started by: Fustbariclation
2 Replies

9. Shell Programming and Scripting

Difference in awk output and while

so, im going over one of my scripts and trying to optimize it. i have a code like this: cksum sjreas.py | awk '{prinnt $1$2}' This does what I need. However, i dont want to call the external command awk. so im doing this: cksum sjreas.py | while OFS=' ' read v1 v2 ; do printf... (4 Replies)
Discussion started by: SkySmart
4 Replies

10. Shell Programming and Scripting

awk to calculate difference of split and sum the difference

In the awk I am trying to subtract the difference $3-$2 of each matching $4 before the first _ (underscore) and print that value in $13. I think the awk will do that, but added comments. What I am not sure off is how to add a line or lines that will add sum each matching $13 value and put it in... (2 Replies)
Discussion started by: cmccabe
2 Replies
Perl6::Junction(3pm)					User Contributed Perl Documentation				      Perl6::Junction(3pm)

NAME
Perl6::Junction - Perl6 style Junction operators in Perl5. SYNOPSIS
use Perl6::Junction qw/ all any none one /; if (any(@grant) eq 'su') { ... } if (all($foo, $bar) >= 10) { ... } if (qr/^d+$/ == all(@answers)) { ... } if (all(@input) <= @limits) { ... } if (none(@pass) eq 'password') { ... } if (one(@answer) == 42) { ... } DESCRIPTION
This is a lightweight module which provides 'Junction' operators, the most commonly used being "any" and "all". Inspired by the Perl6 design docs, <http://dev.perl.org/perl6/doc/design/exe/E06.html>. Provides a limited subset of the functionality of Quantum::Superpositions, see "SEE ALSO" for comment. Notice in the "SYNOPSIS" above, that if you want to match against a regular expression, you must use "==" or "!=". Not "=~" or "!~". You must also use a regex object, such as "qr/d/", not a plain regex such as "/d/". SUBROUTINES
all() Returns an object which overloads the following operators: '<', '<=', '>', '>=', '==', '!=', 'lt', 'le', 'gt', 'ge', 'eq', 'ne', Returns true only if all arguments test true according to the operator used. any() Returns an object which overloads the following operators: '<', '<=', '>', '>=', '==', '!=', 'lt', 'le', 'gt', 'ge', 'eq', 'ne', Returns true if any argument tests true according to the operator used. none() Returns an object which overloads the following operators: '<', '<=', '>', '>=', '==', '!=', 'lt', 'le', 'gt', 'ge', 'eq', 'ne', Returns true only if no argument tests true according to the operator used. one() Returns an object which overloads the following operators: '<', '<=', '>', '>=', '==', '!=', 'lt', 'le', 'gt', 'ge', 'eq', 'ne', Returns true only if one and only one argument tests true according to the operator used. ALTERING JUNCTIONS
You cannot alter junctions. Instead, you can create new junctions out of old junctions. You can do this by calling the "values" method on a junction. my $numbers = any(qw/1 2 3 4 5/); print $numbers == 3 ? 'Yes' : 'No'; # Yes $numbers = any( grep { $_ != 3 } $numbers->values ); print $numbers == 3 ? 'Yes' : 'No'; # No EXPORT
'all', 'any', 'none', 'one', as requested. All subroutines can be called by its fully qualified name, if you don't want to export them. use Perl6::Junction; if (Perl6::Junction::any( @questions )) { ... } WARNING
When comparing against a regular expression, you must remember to use a regular expression object: "qr/d/" Not "/d/". You must also use either "==" or "!=". This is because "=~" and "!~" cannot be overriden. TO DO
Add overloading for arithmetic operators, such that this works: $result = any(2,3,4) * 2; if ($result == 8) {...} SUPPORT
/ BUGS Submit to the CPAN bugtracker <http://rt.cpan.org> SEE ALSO
Quantum::Superpositions provides the same functionality as this, and more. However, this module provides this limited functionality at a much greater runtime speed, with my benchmarks showing between 500% and 6000% improvment. <http://dev.perl.org/perl6/doc/design/exe/E06.html> - "The Wonderful World of Junctions". AUTHOR
Carl Franks ACKNOWLEDGEMENTS
Thanks to "Curtis "Ovid" Poe" for the "ALTERING JUNCTIONS" changes in release 0.40000. COPYRIGHT AND LICENSE
Copyright 2005, Carl Franks. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself (perlgpl, perlartistic). perl v5.10.0 2008-06-20 Perl6::Junction(3pm)
All times are GMT -4. The time now is 09:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy