Sponsored Content
Top Forums Shell Programming and Scripting awk to print out with two possibilities Post 303000461 by MadeInGermany on Wednesday 12th of July 2017 02:39:15 PM
Old 07-12-2017
This one prints the "Variants Detected:" only once, before the first match. And at the END it prints "nothing detected" if there was not a single match. It uses a control variable wasfound.
Code:
awk -v p1="PASS" -v p2="'oncomineGeneClass'" -v p3="'oncomineVariantClass':" '
  !/^#/ && $0 ~ p1 && $0 ~ p2 && $0 ~ p3 {
    if (!wasfound) {
      print "Variants Detected:"
      wasfound=1
    }
    print
  }
  END {
    if (!wasfound) { print "nothing detected" }
  }
' file

This User Gave Thanks to MadeInGermany For This Post:
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

What can you do with unix what are the possibilities

Where do i get unix at (1 Reply)
Discussion started by: shinobikil
1 Replies

2. Shell Programming and Scripting

How do I get awk to print a " in it's print part?

The line is simple, use " '{ print $1"]"$2"\"$3THE " NEEDS TO GO HERE$4 }' I've tried \", "\, ^" and '"" but none of it works. What am I missing? Putting in the [ between $1 and $2 works fine, I just need to do the same with a ". Thanks. (2 Replies)
Discussion started by: LordJezo
2 Replies

3. Shell Programming and Scripting

Awk problem: How to express the single quote(') by using awk print function

Actually I got a list of file end with *.txt I want to use the same command apply to all the *.txt Thus I try to find out the fastest way to write those same command in a script and then want to let them run automatics. For example: I got the file below: file1.txt file2.txt file3.txt... (4 Replies)
Discussion started by: patrick87
4 Replies

4. Shell Programming and Scripting

Find command possibilities

Using find command is the below possible ? find /home/abcd/****/efgh where the "****" can be any name/character. Thanks, Vasanth. (2 Replies)
Discussion started by: skcvasanth
2 Replies

5. Ubuntu

Restricted access possibilities

Hi, I have given a laptop from company with Ubuntu 10.04 on it. I have restricted access over it, means I have been given sudo login on it. SO I am unable to so many major activities over it, Can you all people tell me the Terminal tricks that I can use to get my hands on it. (1 Reply)
Discussion started by: nixhead
1 Replies

6. Shell Programming and Scripting

configure bash completion for multiple possibilities

Hello, Bash completion is great, but there are some features I'd like to change. One thing is the behaviour when there are lots of very similar possibilities. E.g., my directory contains 133 files, from pubmed_result1.txt to pubmed_result133.txt $ ls Lyonprim/p Display all 133... (2 Replies)
Discussion started by: jossojjos
2 Replies

7. Shell Programming and Scripting

Awk: Print count for column in a file using awk

Hi, I have the following input in a file & need output as mentioned below(need counter of every occurance of field which is to be increased by 1). Input: 919143110065 919143110065 919143110052 918648846132 919143110012 918648873782 919143110152 919143110152 919143110152... (2 Replies)
Discussion started by: siramitsharma
2 Replies

8. Shell Programming and Scripting

Script to find the available number possibilities

Hi, I try to get the combination of 6 numbers from (1-60) using any script. Any script that can help me to fix this ... EG: The output should be like that different possibilities from 1-60... 1) 1 3 15 29 30 42 2) 4 5 6 31 44 60 like the above ... Hereas, I need all the possibilities... (5 Replies)
Discussion started by: gsiva
5 Replies
ImVirt(3pm)						User Contributed Perl Documentation					       ImVirt(3pm)

NAME
ImVirt - detects several virtualizations SYNOPSIS
use ImVirt; print imv_get(IMV_PROB_DEFAULT, imv_detect())," "; DESCRIPTION
The "ImVirt" package tries to detect if it is run in a virtualization container. At least the following container should be detected: ARAnyM KVM lguest LXC OpenVZ QEMU UML VirtualBox Virtual PC/Server VMware Xen DETECTION HEURISTIC
The detection is based on a heuristic - you should not trust the result at all. ImVirt probes for different well-known characteristics of different virtualization containers. Any characteristics found or not found are weighted by their significance. The result of the heuristic is a weighted tree. The leaves are the (not) detected containers. FUNCTIONS
The following functions should be used to retrieve the detected virtualization containers: imv_get($prob) Returns exactly one string describing the detected container. If the detected container has a smaller match probability than $prob the string 'Unknown' is returned. imv_get_all() Returns a hash any positive detected containers as keys and their corresponding match probability as value. imv_get_pos_results() Returns a list of all possible results which might be returned by all detection modules. The list entries might be appended by some additional data like version numbers etc. perl v5.14.2 2012-09-01 ImVirt(3pm)
All times are GMT -4. The time now is 07:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy