Sponsored Content
Top Forums Shell Programming and Scripting awk - how do i get the last row of a group Post 302806545 by Lakshmikumari on Monday 13th of May 2013 08:34:18 AM
Old 05-13-2013
Wonderful. Thanks. It works.Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Get value of last row and 6 column from awk

I want to get value of last row and 6 column from awk. Below is the format of my file. And RED one is my desired value. Actaully this stats usally update after every 1 hour so i want that every time i run the script i get the latest value. Ending time - 01:00:58 HOURLY CALL ATTEMPTS... (4 Replies)
Discussion started by: wakhan
4 Replies

2. Shell Programming and Scripting

awk help required to group output and print a part of group line and original line

Hi, Need awk help to group and print lines to format the output as shown below INPUT FORMAT set echo on set heading on set spool on /* SCHEMA1 */ CREATE TABLE T1; /* SCHEMA1 */ CREATE TABLE T2; /* SCHEMA1 */ CREATE TABLE T3; /* SCHEMA1 */ CREATE TABLE T4; /* SCHEMA1 */ CREATE TABLE T5;... (5 Replies)
Discussion started by: rajan_san
5 Replies

3. Shell Programming and Scripting

AWK: row number NR

Hi I've file1 as: after I read all rows with awk, I need to change some of them. I mean, for example if the last row is zero then change row number 4 in zero too. So I'd like to refers each row as a vector and change its value accordly some conditions. I know that NR keep just the "current"... (2 Replies)
Discussion started by: Dedalus
2 Replies

4. Shell Programming and Scripting

awk command : row by row merging of two files

I want to write a scrpit to merge files row wise (actually concatinating) main.txt X Y Z file 1 A B C file 2 1 2 3 now i want the script to check if the file1 is empty or not, if empty then make it like A B C 1 2 3 again to check if second file is empty if not do as done... (0 Replies)
Discussion started by: shashi792
0 Replies

5. Shell Programming and Scripting

Get a group of line from different file and put them into one file row by row

hi guys, today i'm stuck in a new problem. the title explain more or less but a particular had been omitted. So i'm going to describe below the situation with an example. I have different html files and each of them have a consecutive lines group inside that i want to extract. example: ... (8 Replies)
Discussion started by: sbobotex
8 Replies

6. Shell Programming and Scripting

Subtracting each row from the first row in a single column file using awk

Hi Friends, I have a single column data like below. 1 2 3 4 5 I need the output like below. 0 1 2 3 4 where each row (including first row) subtracting from first row and the result should print below like the way shown in output file. Thanks Sid (11 Replies)
Discussion started by: ks_reddy
11 Replies

7. Shell Programming and Scripting

awk get the row

somthing somthing A B C B F A B .... 1 2 3 4 5 6 7 .... 7 9 12 2 4 5 8 I want to get the row which is the same row as B. This this the 2 4 7 9 2 8 (2 Replies)
Discussion started by: yanglei_fage
2 Replies

8. Shell Programming and Scripting

Add a Group ID to each row

I have a sample data like this: user1 1001 role1 user2 1002 role1 role2 user3 1003 role1 role2 role3 And I need to convert it like this: 1,user1 (5 Replies)
Discussion started by: vskr72
5 Replies

9. UNIX for Dummies Questions & Answers

awk to print first row with forth column and last row with fifth column in each file

file with this content awk 'NR==1 {print $4} && NR==2 {print $5}' file The error is shown with syntax error; what can be done (4 Replies)
Discussion started by: cdfd123
4 Replies

10. Shell Programming and Scripting

Filter Row Based On Max Column Value After Group BY

Hello Team, Need your expertise on following: Here is the set of data: C1|4|C1SP1|A1|C1BP1|T1 C1|4|C1SP2|A1|C1BP2|T2 C2|3|C2SP1|A2|C2BP1|T2 C3|3|C3SP1|A3|C3BP1|T2 C2|2|C2SP2|A2|C2BP2|T1 I need to filter above date base on following two steps: 1. Group them by column 1 and 4 2.... (12 Replies)
Discussion started by: angshuman
12 Replies
Syntax::Keyword::Junction(3)				User Contributed Perl Documentation			      Syntax::Keyword::Junction(3)

NAME
Syntax::Keyword::Junction - Perl6 style Junction operators in Perl5 VERSION
version 0.003007 SYNOPSIS
use Syntax::Keyword::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) { ... } or if you want to rename an export, use Sub::Exporter options: use Syntax::Keyword::Junction any => { -as => 'robot_any' }; if (robot_any(@grant) eq 'su') { ... } 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 You can also use the "map" method: my $numbers = any(qw/1 2 3 4 5/); my $prime = $numbers->map( &is_prime ); say for $prime->values; # prints 0, 1, 1, 0, 1 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 Syntax::Keyword::Junction; if (Syntax::Keyword::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 overridden. TO DO
Add overloading for arithmetic operators, such that this works: $result = any(2,3,4) * 2; if ($result == 8) {...} SEE ALSO
This module is actually a fork of Perl6::Junction with very few (initial) changes. The reason being that we want to avoid the incendiary name containing Perl6. 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% improvement. <http://dev.perl.org/perl6/doc/design/exe/E06.html> - "The Wonderful World of Junctions". AUTHORS
o Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com> o Carl Franks COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Arthur Axel "fREW" Schmidt. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.18.2 2013-11-23 Syntax::Keyword::Junction(3)
All times are GMT -4. The time now is 04:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy