Sponsored Content
Full Discussion: Duplication | awk | result
Top Forums UNIX for Beginners Questions & Answers Duplication | awk | result Post 303035755 by RudiC on Sunday 2nd of June 2019 09:10:38 AM
Old 06-02-2019
OK, that's what I inferred. How about (the first line will work with a recent shell only)
Code:
if [[ "ALA ARG ASN ASP CYS GLN GLY GLU HIS ILE LEU LYS MET PHE PRO SER THR TRP TYR VAL" =~ $AAA ]]
  then  for i in HS_*.pdb
          do  cat $i | voronota get-balls-from-atoms-file --annotated | \
                  awk -F"[<>]" -vSRCH="$AAA" '$0 ~ SRCH && !OCC[$4]++ {CNT++ } END {print CNT+0}' $i 
          done
  else  echo exit 1
fi
2

 

10 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

File Duplication

hi all how to find the file duplication in a windows 2000 server as usual replies are sincerely appreciated. thanks raguram R (3 Replies)
Discussion started by: raguramtgr
3 Replies

2. HP-UX

awk to output cmd result

I was wondering if it was possible to tell awk to print the output of a command in the print. .... | awk '{print $0}' I would like it to print the date right before $0, so something like (this doesn't work though) .... | awk '{print date $0}' (4 Replies)
Discussion started by: IMTheNachoMan
4 Replies

3. UNIX for Advanced & Expert Users

mount LVM duplication drives

Hi, I'm stuck in an awkward situation please help :) I have two identical Seagate 80GB harddrives. My objective is a bit strange. 1.I want to have a cloned disk as bootable backup 2.When booting using the master drive, I also want to mount the cloned backup disk so I can do incremental... (6 Replies)
Discussion started by: onthetopo
6 Replies

4. Shell Programming and Scripting

File Duplication Script?

I have a file, let's say 1.jpg, and I have a text file that contains a list of filenames I would like to duplicate 1.jpg as (i.e., 2.jpg, 3.jpg, 4.jpg, etc.). The filenames that I want to create are all on separate lines, one per line. I'm sure there's a simple solution, but I'm not claiming to... (7 Replies)
Discussion started by: futurestar
7 Replies

5. Shell Programming and Scripting

How to avoid duplication within 2 files?

Hi all, Actually 2 files are there - file1, file2. file1 contains ---> london mosco america russia mosco file2 contains --> europe india japan mosco england london Question is I want to print all the city names without duplication cities in those... (10 Replies)
Discussion started by: balan_mca
10 Replies

6. UNIX for Advanced & Expert Users

File Descriptor redirection and duplication

i have many questions concerning the FD. it was stated that "to redirect Error to output std, you have to write the following code" # ls -alt FileNotThere File > logfile 2>&1 # cat logfile ls: cannot access FileNotThere: No such file or directory -rw-r--r-- 1 root root 0 2010-02-26... (9 Replies)
Discussion started by: ahmad.zuhd
9 Replies

7. Programming

Table Duplication in PHP

Hey, I am making a Facebook like Page system as my first project, So far it's been bate in mind I did it from my 3DS at the same time as my PC gets replaced, So far it's turned out great. Now I am on to creation the blocking system I need to get the code to say If the user already likes the... (0 Replies)
Discussion started by: AimyThomas
0 Replies

8. Linux

De-Duplication Problem

Hi all, I download and install lessfs for deduplication, I copy files in /SharedFiles directory and lessfs work right and not store again copy files, but, when i delete all files in /SharedFiles , not return free space to total space, files not show in /SharedFiles , but not copy new files in... (3 Replies)
Discussion started by: saeedha
3 Replies

9. UNIX for Beginners Questions & Answers

Line duplication with awk?!

So while this seemed totally trivial it turned out to be much more difficult than I had thought. I have a file with 3 rows, and I "just" want to add each field n number of times. E.g. > cat file.txt 0.5 -0.1 0.6 for n=3 into: cat newfile.txt 0.5 0.5 0.5 -0.1 -0.1 -0.1 0.6 0.6 0.6 I... (4 Replies)
Discussion started by: Glorp
4 Replies

10. UNIX for Beginners Questions & Answers

Unexpected result from awk

Hello, Giving those commands: cat > myfile 1 2 3 ^D cat myfile | awk '{ s=s+$1 ; print s}' The output is: 1 3 6 It seems like this command iterates each time on a different row so $1 is the first field of each row.. But what caused it to refer to each row ?. What I mean... (3 Replies)
Discussion started by: uniran
3 Replies
Net::Ifconfig::Wrapper(3pm)				User Contributed Perl Documentation			       Net::Ifconfig::Wrapper(3pm)

NAME
Net::Ifconfig::Wrapper - provides a unified way to configure network interfaces on FreeBSD, OpenBSD, Solaris, Linux, OS X, and WinNT (from Win2K). Version 0.11 SYNOPSIS
#!/usr/local/bin/perl -w # uni-ifconfig.pl # The unified ifconfig command. # Works the same way on FreeBSD, OpenBSD, Solaris, Linux, OS X, WinNT (from Win2K). # Note: due of Net::Ifconfig::Wrapper limitations 'inet' and 'down' commands # are not working on WinNT. +/-alias are working, of course. use strict; use Net::Ifconfig::Wrapper; my $Usage = << 'EndOfText'; uni-ifconfig.pl # Print this notice uni-ifconfig.pl -a # Print info about all interfaces uni-ifconfig.pl <iface> # Print info obout specified interface uni-ifconfig.pl <iface> down # Bring specified interface down uni-ifconfig.pl <iface> inet <AAA.AAA.AAA.AAA> mask <MMM.MMM.MMM.MMM> # Set the specified address on the specified interface # and bring this interface up uni-ifconfig.pl <iface> inet <AAA.AAA.AAA.AAA> mask <MMM.MMM.MMM.MMM> [+]alias # Set the specified alias address # on the specified interface uni-ifconfig.pl <iface> inet <AAA.AAA.AAA.AAA> [mask <MMM.MMM.MMM.MMM>] -alias # Remove specified alias address # from the specified interface EndOfText my $Info = Net::Ifconfig::Wrapper::Ifconfig('list', '', '', '') or die $@; scalar(keys(%{$Info})) or die "No one interface found. Something wrong? "; if (!scalar(@ARGV)) { print $Usage; exit 0; } if ($ARGV[0] eq '-a') { defined($ARGV[1]) and die $Usage; foreach (sort(keys(%{$Info}))) { print IfaceInfo($Info, $_); }; exit 0; }; $Info->{$ARGV[0]} or die "Interface '$ARGV[0]' is unknown "; if (!defined($ARGV[1])) { print IfaceInfo($Info, $ARGV[0]); exit 0; } my $CmdLine = join(' ', @ARGV); my $Result = undef; if ($CmdLine =~ m/As*([w{}-]+)s+downs*/i) { $Result = Net::Ifconfig::Wrapper::Ifconfig('down', $1, '', ''); } elsif ($CmdLine =~ m/As*([w{}-]+)s+inets+(d{1,3}(?:.d{1,3}){3})s+masks+(d{1,3}(?:.d{1,3}){3})s*/i) { $Result = Net::Ifconfig::Wrapper::Ifconfig('inet', $1, $2, $3); } elsif ($CmdLine =~ m/As*([w{}-]+)s+inets+(d{1,3}(?:.d{1,3}){3})s+masks+(d{1,3}(?:.d{1,3}){3})s++?aliass*/i) { $Result = Net::Ifconfig::Wrapper::Ifconfig('+alias', $1, $2, $3); } elsif ($CmdLine =~ m/As*([w{}-]+)s+inets+(d{1,3}(?:.d{1,3}){3})s+(:?masks+(d{1,3}(?:.d{1,3}){3})s+)?-aliass*/i) { $Result = Net::Ifconfig::Wrapper::Ifconfig('-alias', $1, $2, ''); } else { die $Usage; }; $Result or die $@; exit 0; sub IfaceInfo { my ($Info, $Iface) = @_; my $Res = "$Iface: ".($Info->{$Iface}{'status'} ? 'UP' : 'DOWN')." "; while (my ($Addr, $Mask) = each(%{$Info->{$Iface}{'inet'}})) { $Res .= sprintf(" inet %-15s mask $Mask ", $Addr); }; $Info->{$Iface}{'ether'} and $Res .= " ether ".$Info->{$Iface}{'ether'}." "; $Info->{$Iface}{'descr'} and $Res .= " descr '".$Info->{$Iface}{'descr'}."' "; return $Res; }; DESCRIPTION
This module provides a unified way to configure the network interfaces on FreeBSD, OpenBSD, Solaris, Linux, OS X, and WinNT (from Win2K) systems. Only "inet" (IPv4) and "ether" (MAC) addresses are supported at the moment On Unixes this module calls the system "ifconfig" command to perform the actions. On Windows the functions from IpHlpAPI.DLL are called. For all supported Unixes "Net::Ifconfig::Wrapper" expect "ifconfig" command to be "/sbin/ifconfig". Module was tested on FreeBSD 4.7,4.8,5.3 (Intel), RedHat 6.2,7.3,8.0 (Intel), Win2000 Pro (Intel), OpenBSD 3.1 (SPARC), Solaris 7 (SPARC), OS X 10.3 (aka Panther), OS X 10.4 (aka Tiger). In MSWin32 family only WinNT is supported. In WinNT family only Win2K or later is supported. The Net::Ifconfig::Wrapper methods "Ifconfig(Command, Interface, Address, Netmask);" The first and the last method of the "Net::Ifconfig::Wrapper" module. Do all the job. The particular action is described by the $Command parameter. $Command could be: 'list' "Ifconfig('list', '', '', '')" will return the reference to the hash contains the information about interfaces. The structure of this hash is the following: {IfaceName => {'status' => 0|1 # The status of the interface. 0 means down, 1 means up 'ether' => MACaddr, # The ethernet address of the interface if available 'descr' => Description, # The description of the interface if available 'inet' => {IPaddr1 => NetMask, # The IP address and his netmask, both are in AAA.BBB.CCC.DDD notation IPaddr2 => NetMask, ... }, ... }; Interface, Address, Netmask parameters are ignored. The following programs are called: FreeBSD "/sbin/ifconfig -a" Solaris "/sbin/ifconfig -a" OpenBSD "/sbin/ifconfig -A" Linux "/sbin/ifconfig -a" OS X "/sbin/ifconfig -a" MSWin32 "GetAdaptersInfo" function from "IpHlpAPI.DLL" Limitations: OpenBSD: "/sbin/ifconfig -A" command is not returning information about MAC addresses so we are trying to get it from '/usr/sbin/arp -a' command (first 'static' entry). If no one present the 'ff:ff:ff:ff:ff' address is returned. MSWin32: "GetAdaptersInfo" function is not returning information about interface which have address 127.0.0.1 binded so "Net::Ifconfig::Wrapper" have no ability to display it. Not limitation but little problem: MSWin32 interface names are not human-readable, they looks like "{843C2077-30EC-4C56-A401-658BB1E42BC7}" (on Win2K at least). 'inet' This function is used to set IPv4 address on interface. It have to be called as Ifconfig('inet', $IfaceName, $Addr, $Mask); $IfaceName is an interface name as displayed by 'list' command $Addr is an IPv4 address in the "AAA.AAA.AAA.AAA" notation $Mask is an IPv4 subnet mask in the "MMM.MMM.MMM.MMM" notation The following actual "ifconfig" programs are called FreeBSD "/sbin/ifconfig %Iface% inet %Addr% netmask %Mask% up" Solaris "/sbin/ifconfig %Iface% inet %Addr% netmask %Mask% up" OpenBSD "/sbin/ifconfig %Iface% inet %Addr% netmask %Mask% up" Linux "/sbin/ifconfig %Iface% inet %Addr% netmask %Mask% up" OS X "/sbin/ifconfig %Iface% inet %Addr% netmask %Mask% up" MSWin32: nothing :( Limitations: MSWin32: I did not find the relaible way to recognize the "main" address on the Win32 network interface, so I have disabled this functionality. If you know the way please let me know. 'up' Just a synonym for 'inet' 'down' This function is used to bring specified interface down. It have to be called as Ifconfig('inet', $IfaceName, '', ''); $IfaceName is an interface name as displayed by 'list' command Address and Netmask are ignored. The following actual "ifconfig" programs are called FreeBSD "/sbin/ifconfig %Iface% down" Solaris "/sbin/ifconfig %Iface% down" OpenBSD "/sbin/ifconfig %Iface% down" Linux "/sbin/ifconfig %Iface% down" OS X "/sbin/ifconfig %Iface% down" MSWin32 nothing :( Limitations: MSWin32: I did not find the way to implement the 'up' command so I did not implement 'down'. '+alias' This function is used to set IPv4 alias address on interface. It have to be called as Ifconfig('+alias', $IfaceName, $Addr, $Mask); $IfaceName is an interface name as displayed by 'list' command $Addr is an IPv4 address in the "AAA.AAA.AAA.AAA" notation $Mask is an IPv4 subnet mask in the "MMM.MMM.MMM.MMM" notation The following actual "ifconfig" programs are called FreeBSD "/sbin/ifconfig %Iface% inet %Addr% netmask %Mask% alias" Solaris "/sbin/ifconfig %Iface%:%Logic% inet %Addr% netmask %Mask% up" OpenBSD "/sbin/ifconfig %Iface% inet %Addr% netmask %Mask% alias" Linux "/sbin/ifconfig %Iface%:%Logic% inet %Addr% netmask %Mask% up" OS X "/sbin/ifconfig %Iface% inet %Addr% netmask %Mask% alias" MSWin32 "AddIPAddress" function from "IpHlpAPI.DLL" First available logic interface is taken automatically for Solaris and Linux 'alias' Just a synonim for '+alias' '-alias' This function is used to remove IPv4 alias address from interface. It have to be called as Ifconfig('-alias', $IfaceName, $Addr, ''); $IfaceName is an interface name as displayed by 'list' command $Addr is an IPv4 address in the "AAA.AAA.AAA.AAA" notation Netmask> parameter is ignored The following actual "ifconfig" programs are called FreeBSD "/sbin/ifconfig %Iface% inet %Addr% -alias" Solaris "/sbin/ifconfig %Iface%:%Logic% down" OpenBSD "/sbin/ifconfig %Iface% inet %Addr% -alias" Linux "/sbin/ifconfig %Iface%:%Logic% down" OS X "/sbin/ifconfig %Iface% inet %Addr% -alias" MSWin32 "DeleteIPAddress" function from "IpHlpAPI.DLL" Appropriate logic interface is obtained automatically for Solaris and Linux On success "Ifconfig(...)" returns the defined value. Actually, it is a reference to the array contains the output of the actual "ifconfig" program called. In case of troubles "Ifconfig(...)" returns 'undef' value, $@ variable contains the error message. EXPORT None by default. AUTHOR
Daniel Podolsky, <tpaba@cpan.org> SEE ALSO
ifconfig(8), Internet Protocol Helper in Platform SDK. perl v5.14.2 2012-01-19 Net::Ifconfig::Wrapper(3pm)
All times are GMT -4. The time now is 02:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy