Sponsored Content
Top Forums Shell Programming and Scripting Need to show highest version line from the list Post 302973052 by Skrynesaver on Friday 13th of May 2016 08:15:08 AM
Old 05-13-2016
Untested but you get the idea...

Code:
ls -R lib/SBSSchemaProject.jar/schemas/ | perl -ne '($schema,$major,$minor)=$_=~/\/(\w+)_v(\d+)_9\d+).xsd$/;if (($major > $max_major)||(($major == $max_major{$schema}) && ($minor>$max_minor{$schema}){$max{$schema}=$_;$max_major{$schema}=$major;$max_minor{$schema}==$minor;}END{for $schema (keys %max){print "$max{$schema}\n";}}' -

This User Gave Thanks to Skrynesaver For This Post:
 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Printing highest value from a list

Hi all, I'm trying to get the item with the maximum value, and was wondering if someone can help me with it. Heres my input file: apples 15 books 15 books 17 pens 12 pens 15 umbrella 13Here's what my output file should look like: apples 15 books 17 pens 15 umbrella 13 Can... (2 Replies)
Discussion started by: r4v3n
2 Replies

2. Shell Programming and Scripting

Filtering out duplicates with the highest version number

Hi, I have a huge text file with filenames which which looks like the following ie uniquenumber_version_filename: e.g. 1234_1_xxxx 1234_2_vfvfdbb 343333_1_vfvfdvd 2222222_1_ggggg 55555_1_xxxxxx 55555_2_vrbgbgg 55555_3_grgrbr What I need to do is examine the file, look for... (4 Replies)
Discussion started by: mantis
4 Replies

3. Shell Programming and Scripting

Need to print duplicate row along with highest version of original

There are some duplicate field on description column .I want to print duplicate row along with highest version of number and corresponding description column. file1.txt number Description === ============ 34567 nl21a00is-centerdb001:ncdbareq:Error in loading init 34577 ... (7 Replies)
Discussion started by: vijay_rajni
7 Replies

4. Shell Programming and Scripting

Parse line based on highest value

Hello, Does anyone know how to parse whole line that has highest value in last column (c12), based on the string in column 6 (column VIRUS) INPUT: 5 7 4 8 3 VIRUS1 5 5 HUMAN1 8 4 100 6 9 7 2 6 VIRUS1 6 0 HUMAN2 6 2 80 9 6 7 3 7 VIRUS1 9 7 HUMAN3 5 9 70 8 5 3 8 6 VIRUS2 8 6 HUMAN4 8 6 95... (3 Replies)
Discussion started by: narachaid
3 Replies

5. Shell Programming and Scripting

How to find the X highest values in a list depending on the values of another list with bash/awk?

Hi everyone, This is an exemple of inpout.txt file (a "," delimited text file which can be open as csv file): ID, Code, Value, Store SP|01, AABBCDE, 15, 3 SP|01, AABBCDE, 14, 2 SP|01, AABBCDF, 13, 2 SP|01, AABBCDE, 16, 3 SP|02, AABBCED, 15, 2 SP|01, AABBCDF, 12, 3 SP|01, AABBCDD,... (1 Reply)
Discussion started by: jeremy589
1 Replies

6. Shell Programming and Scripting

Print whole line with highest value from one column

Hi, I have a little issue right now. I have a file with 4 columns test0000002,10030010330,c_,218 test0000002,10030010330,d_,202 test0000002,10030010330,b_,193 test0000002,10030010020,c_,178 test0000002,10030010020,b_,170 test0000002,10030010330,a_,166 test0000002,10030010020,a_,151... (3 Replies)
Discussion started by: Ebk
3 Replies

7. UNIX for Beginners Questions & Answers

awk print line with highest value

grepping on a value but then want to print only those lines that have the highest value in the 4th column log text text R59FJ log text text R63FT log text text R60JX log1 text text R63EA log1 text text R60JX desired output log text text R63FT log1 text text R63EAtried this but not getting... (2 Replies)
Discussion started by: jimmyf
2 Replies
ZGREP(1)						      General Commands Manual							  ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 04:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy