Sponsored Content
Top Forums Shell Programming and Scripting awk to skip lines find text and add text based on number Post 302966802 by cmccabe on Tuesday 16th of February 2016 04:27:09 PM
Old 02-16-2016
In addition to capturing the STB= value, how can I also capture the FDP= value and whatever the value is of FDP= "reads" appears next to the text "STRAND BIAS" or "GOOD". Thank you Smilie.

Code:
perl -ple '/^[^#].*FDP=(\d+);*STB=(\d+\.\d+);/ and $1_= <30 $_.=$2 >= 0.8?" STRAND BIAS":" GOOD""$1 "reads""'

desired output:
Code:
##
##
##
....
....
....
#CHROM    POS    ID    REF    ALT    QUAL    FILTER
..... GOOD  128 reads
..... GOOD  317 reads
..... GOOD  128 reads
..... STRAND BIAS  20 reads

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to combine 2 lines in same files based on any text

hi, I want to combine two lines in same file. If the line ends with '&' it should belongs to previous line only Here i am writing example. Ex1: line 1 : return abcdefgh& line 2 : ijklmnopqr& line 3 : stuvw& line 4 : xyz output should be line 1: return abcdefghijklmnopqrstuvwxyz ... (11 Replies)
Discussion started by: spc432
11 Replies

2. Shell Programming and Scripting

How to skip lines which don't begin with a number

Hi, I have a file: file.txt 1 word 2 word word word 3 word 4 word and I would like to create a set: set number = `cut -d" " -f1 ${1}` #${1} is the text file but it should only contain the lines which begin with numbers, and another set which contains the lines which begin with... (10 Replies)
Discussion started by: shira
10 Replies

3. Shell Programming and Scripting

Find and add/replace text in text files

Hi. I would like to have experts help on below action. I have text files in which page nubmers exists in form like PAGE : 1 PAGE : 2 PAGE : 3 and so on there is other text too. I would like to know is it possible to check the last occurance of Page... (6 Replies)
Discussion started by: lodhi1978
6 Replies

4. Shell Programming and Scripting

How to merge lines based off of text?

Hello Everyone, I have two files, similar to the following: File 1: 8010 ITEM01 CODE1 FLAG1 filler filler 7020 OBJECT CODE2 FLAG2 filler 6010 THING1 CODE4 FLAG4 6011 ITEM20 CODE7 FLAG7 File 2 contains: 6020 ITEM01 CODEA FLAGA filler filler filler 7000 OBJECT CODEB... (2 Replies)
Discussion started by: jl487
2 Replies

5. UNIX for Dummies Questions & Answers

Extracting lines from a text file based on another text file with line numbers

Hi, I am trying to extract lines from a text file given a text file containing line numbers to be extracted from the first file. How do I go about doing this? Thanks! (1 Reply)
Discussion started by: evelibertine
1 Replies

6. Shell Programming and Scripting

How to delete lines of a text file based on another text file?

I have 2 TXT files with with 8 columns in them(tab separated). First file has 2000 entries whereas 2nd file has 300 entries. The first file has ALL the lines of second file. Now I need to remove those 300 lines (which are in both files) from first file so that first file's line count become... (2 Replies)
Discussion started by: prvnrk
2 Replies

7. Shell Programming and Scripting

awk - Skip x Number of Lines in Counter

Hello, I am new to AWK and in UNIX in general. I am hoping you can help me out here. Here is my data: root@ubuntu:~# cat circuits.list WORD1 AA BB CC DD Active ISP1 ISP NAME1 XX-XXXXXX1 WORD1 AA BB CC (9 Replies)
Discussion started by: tattoostreet
9 Replies

8. UNIX for Beginners Questions & Answers

How to find=grep or maybe sed/awk for multiple lines of text?

Hi, I am running the following: PASS="username/password" sqlplus -s << EOF | grep -v "^$" $PASS set feedback off set heading off set termout off select name from v\$database ; exit EOF Which gives ERROR: ORA-28002: the password will expire within 5 days PSMP1 (1 Reply)
Discussion started by: newbie_01
1 Replies

9. Shell Programming and Scripting

awk to print lines based on text in field and value in two additional fields

In the awk below I am trying to print the entire line, along with the header row, if $2 is SNV or MNV or INDEL. If that condition is met or is true, and $3 is less than or equal to 0.05, then in $7 the sub pattern :GMAF= is found and the value after the = sign is checked. If that value is less than... (0 Replies)
Discussion started by: cmccabe
0 Replies

10. Shell Programming and Scripting

awk to add value and text to specific lines

In the awk I have a very large tab-delimeted file that I am trying to extract the DP= value put it in $16 and add specific text to $16 with . (dot) in $11-$15 and $18. Only the lines (there are several) that have the formating below in file will have an empty $16. Other lines will be in a... (6 Replies)
Discussion started by: cmccabe
6 Replies
Info::Layer3::HP9300(3pm)				User Contributed Perl Documentation				 Info::Layer3::HP9300(3pm)

NAME
SNMP::Info::Layer3::HP9300 - SNMP Interface to HP Foundry OEM Network Devices AUTHOR
Eric Miller SYNOPSIS
# Let SNMP::Info determine the correct subclass for you. my $hp9300 = new SNMP::Info( AutoSpecify => 1, Debug => 1, DestHost => 'myswitch', Community => 'public', Version => 1 ) or die "Can't connect to DestHost. "; my $class = $hp9300->class(); print "SNMP::Info determined this device to fall under subclass : $class "; DESCRIPTION
Abstraction subclass for HP network devices which Foundry Networks was the Original Equipment Manufacturer (OEM) such as the HP ProCurve 9300 series. For speed or debugging purposes you can call the subclass directly, but not after determining a more specific class using the method above. my $hp9300 = new SNMP::Info::Layer3::HP9300(...); Inherited Classes SNMP::Info::Layer3; SNMP::Info::FDP; SNMP::Info::LLDP; Required MIBs HP-SN-ROOT-MIB HP-SN-AGENT-MIB HP-SN-SWITCH-GROUP-MIB Inherited Classes' MIBs See "Required MIBs" in SNMP::Info::Layer3 for its own MIB requirements. See "Required MIBs" in SNMP::Info::FDP for its own MIB requirements. See "Required MIBs" in SNMP::Info::LLDP for its own MIB requirements. GLOBALS
These are methods that return scalar value from SNMP $hp9300->model() Returns model type. Checks $hp9300->id() against the HP-SN-ROOT-MIB and removes "hpSwitch". $hp9300->vendor() Returns 'hp' $hp9300->os() Returns 'hp' $hp9300->os_ver() Returns the software version $hp9300->mac() Returns MAC Address of root port. ("ifPhysAddress.1") $hp9300->chassis() Returns Chassis type. ("entPhysicalDescr.1") $hp9300->serial() Returns serial number of device. $hp9300->temp() Returns the chassis temperature ("snChasActualTemperature") $hp9300->ps1_type() Returns the Description for the power supply ("snChasPwrSupplyDescription.1") $hp9300->ps1_status() Returns the status of the power supply. ("snChasPwrSupplyOperStatus.1") $hp9300->fan() Returns the status of the chassis fan. ("snChasFanOperStatus.1") Global Methods imported from SNMP::Info::Layer3 See documentation in "GLOBALS" in SNMP::Info::Layer3 for details. Global Methods imported from SNMP::Info::FDP See documentation in "GLOBALS" in SNMP::Info::FDP for details. Global Methods imported from SNMP::Info::LLDP See documentation in "GLOBALS" in SNMP::Info::LLDP for details. TABLE METHODS
These are methods that return tables of information in the form of a reference to a hash. Overrides $hp9300->interfaces() Returns reference to hash of interface names to iids. $hp9300->i_ignore() Returns reference to hash of interfaces to be ignored. Ignores interfaces with descriptions of tunnel,loopback,null $hp9300->i_duplex() Returns reference to hash of interface link duplex status. Crosses $hp9300->sw_duplex() with $hp9300->sw_index() Switch Port Information Table ("snSwPortIfTable") $hp9300->sw_index() Returns reference to hash. Maps Table to Interface IID. ("snSwPortIfIndex") $hp9300->sw_duplex() Returns reference to hash. Current duplex status for switch ports. ("snSwPortInfoChnMode") $hp9300->sw_type() Returns reference to hash. Current Port Type . ("snSwPortInfoMediaType") $hp9300->sw_speed() Returns reference to hash. Current Port Speed. ("snSwPortInfoSpeed") Topology information Based upon the software version devices may support Foundry Discovery Protocol (FDP) and Link Layer Discovery Protocol (LLDP). These methods will query both and return the combination of all information. As a result, there may be identical topology information returned from the two protocols causing duplicate entries. It is the calling program's responsibility to identify any duplicate entries and remove duplicates if necessary. $hp9300->hasCDP() Returns true if the device is running either FDP or LLDP. $hp9300->c_if() Returns reference to hash. Key: iid Value: local device port (interfaces) $hp9300->c_ip() Returns reference to hash. Key: iid Value: remote IPv4 address If multiple entries exist with the same local port, c_if(), with the same IPv4 address, c_ip(), it may be a duplicate entry. If multiple entries exist with the same local port, c_if(), with different IPv4 addresses, c_ip(), there is either a non-FDP/LLDP device in between two or more devices or multiple devices which are not directly connected. Use the data from the Layer2 Topology Table below to dig deeper. $hp9300->c_port() Returns reference to hash. Key: iid Value: remote port (interfaces) $hp9300->c_id() Returns reference to hash. Key: iid Value: string value used to identify the chassis component associated with the remote system. $hp9300->c_platform() Returns reference to hash. Key: iid Value: Remote Device Type Table Methods imported from SNMP::Info::Layer3 See documentation in "TABLE METHODS" in SNMP::Info::Layer3 for details. Table Methods imported from SNMP::Info::FDP See documentation in "TABLE METHODS" in SNMP::Info::FDP for details. Table Methods imported from SNMP::Info::LLDP See documentation in "TABLE METHODS" in SNMP::Info::LLDP for details. perl v5.12.4 2011-09-28 Info::Layer3::HP9300(3pm)
All times are GMT -4. The time now is 08:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy