Sponsored Content
Top Forums Shell Programming and Scripting exact string match ; search and print match Post 302423817 by bash_in_my_head on Saturday 22nd of May 2010 03:44:05 PM
Old 05-22-2010
works! thanks!

Works like a charm! thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How do I search a File for a string exact match

Hi, Can you help please. I have the following comand: if ]; then l_valid_string="Y" fi The problem I am trying to solve is that my l_string = ABC and my file contains ABC ABC_EFG I only want back the value ABC exact match. (3 Replies)
Discussion started by: CAGIRL
3 Replies

2. UNIX for Dummies Questions & Answers

exact string match in a word

Hi all, Is anyone able to help with the following query? I have an input file with several lines of words, e.g. "hellolaylahello" "hellohellohellolayla" I want to search for the exact string "hello" in each line and display: 2 "hellolaylahello" 3 "hellohellohellolayla" I... (11 Replies)
Discussion started by: dr_sabz
11 Replies

3. Shell Programming and Scripting

Searching for exact match in a string ??

Hi I have a string of the form XY_X1998.10.500. I want to check in a script that the middle part is always 10. How to achieve this? e.g the input can be XY_X1998.20.500 OR XY_X1998.50.500 OR XY_X1998.10.500. I have to print Yes everytime the middle value is 10 and NO when the middle... (2 Replies)
Discussion started by: skyineyes
2 Replies

4. Shell Programming and Scripting

Finding exact match string

Hi All, I'm writing unix script, it should find exact matching in search string. Looks simple but when i started i'm stuck to find the exact match character string. The unix script reads the records from DB Table. The table will have values something likes these Feed : A Feed File name :... (3 Replies)
Discussion started by: luckybalaji
3 Replies

5. Shell Programming and Scripting

print lines with exact pattern match

I have in a file domain.com. 1909 IN A 1.22.33.44 domain.com. 1909 IN A 22.33.44.55 ns1.domain.com. 1699 IN A 33.44.55.66 ns2.domain.com. 1806 IN A 77.77.66.66 I need to "grep" or "awk" out the lines starting with domain.com. as follows. domain.com. 1909 IN A 1.22.33.44 domain.com.... (3 Replies)
Discussion started by: anilcliff
3 Replies

6. Shell Programming and Scripting

print column value after exact match of variables in file

I have file like below summit hvar_rgrpd_10d_hvams17_ _kgr_prod.rec checksum checksum us europe summit hvar_rgrpd_10d_hvams17_ _kgr_prod.xml var summit us ... (5 Replies)
Discussion started by: manas_ranjan
5 Replies

7. Shell Programming and Scripting

Get the exact match of the string!

Hi All, I am breaking my head in trying to get a command that will exactly match my given string. I have searched net and found few of the options - grep -F $string file grep -x $string file grep "^${string}$" file awk '/"${string}"/ {print $0}' file strangely nothing seems to... (3 Replies)
Discussion started by: dips_ag
3 Replies

8. Shell Programming and Scripting

Help match the exact string

I just want to match "binutils1_test" only, and print the match line only lyang001@lyang001-OptiPlex-9010:/tmp$ cat file zbinutils1_test bbinutils1_test binutils1_test w-binutils1_test lyang001@lyang001-OptiPlex-9010:/tmp$ cat file |grep -w 'binutils1_test' ... (7 Replies)
Discussion started by: yanglei_fage
7 Replies

9. Shell Programming and Scripting

Grep command to search a regular expression in a line an only print the string after the match

Hello, one step in a shell script i am writing, involves Grep command to search a regular expression in a line an only print the string after the match an example line is below /logs/GRAS/LGT/applogs/lgt-2016-08-24/2016-08-24.8.log.zip:2016-08-24 19:12:48,602 ERROR... (9 Replies)
Discussion started by: Ramneekgupta91
9 Replies

10. Shell Programming and Scripting

awk to update file based on partial match in field1 and exact match in field2

I am trying to create a cronjob that will run on startup that will look at a list.txt file to see if there is a later version of a database using database.txt as the source. The matching lines are written to output. $1 in database.txt will be in list.txt as a partial match. $2 of database.txt... (2 Replies)
Discussion started by: cmccabe
2 Replies
Complex(3pm)						User Contributed Perl Documentation					      Complex(3pm)

NAME
PDL::Complex - handle complex numbers SYNOPSIS
use PDL; use PDL::Complex; DESCRIPTION
This module features a growing number of functions manipulating complex numbers. These are usually represented as a pair "[ real imag ]" or "[ angle phase ]". If not explicitly mentioned, the functions can work inplace (not yet implemented!!!) and require rectangular form. While there is a procedural interface available ("$a/$b*$c <=> Cmul (Cdiv $a, $b), $c)"), you can also opt to cast your pdl's into the "PDL::Complex" datatype, which works just like your normal piddles, but with all the normal perl operators overloaded. The latter means that "sin($a) + $b/$c" will be evaluated using the normal rules of complex numbers, while other pdl functions (like "max") just treat the piddle as a real-valued piddle with a lowest dimension of size 2, so "max" will return the maximum of all real and imaginary parts, not the "highest" (for some definition) TIPS, TRICKS &; CAVEATS o "i" is a constant exported by this module, which represents "-1**0.5", i.e. the imaginary unit. it can be used to quickly and conviniently write complex constants like this: "4+3*i". o Use "r2C(real-values)" to convert from real to complex, as in "$r = Cpow $cplx, r2C 2". The overloaded operators automatically do that for you, all the other functions, do not. So "Croots 1, 5" will return all the fifths roots of 1+1*i (due to threading). o use "cplx(real-valued-piddle)" to cast from normal piddles into the complex datatype. Use "real(complex-valued-piddle)" to cast back. This requires a copy, though. o This module has received some testing by Vanuxem Gregory (g.vanuxem at wanadoo dot fr). Please report any other errors you come across! EXAMPLE WALK-THROUGH The complex constant five is equal to "pdl(1,0)": pdl> p $x = r2C 5 5 +0i Now calculate the three roots of of five: pdl> p $r = Croots $x, 3 [1.70998 +0i -0.854988 +1.48088i -0.854988 -1.48088i] Check that these really are the roots of unity: pdl> p $r ** 3 [5 +0i 5 -1.22465e-15i 5 -7.65714e-15i] Duh! Could be better. Now try by multiplying $r three times with itself: pdl> p $r*$r*$r [5 +0i 5 -4.72647e-15i 5 -7.53694e-15i] Well... maybe "Cpow" (which is used by the "**" operator) isn't as bad as I thought. Now multiply by "i" and negate, which is just a very expensive way of swapping real and imaginary parts. pdl> p -($r*i) [0 -1.70998i 1.48088 +0.854988i -1.48088 +0.854988i] Now plot the magnitude of (part of) the complex sine. First generate the coefficients: pdl> $sin = i * zeroes(50)->xlinvals(2,4) + zeroes(50)->xlinvals(0,7) Now plot the imaginary part, the real part and the magnitude of the sine into the same diagram: pdl> line im sin $sin; hold pdl> line re sin $sin pdl> line abs sin $sin Sorry, but I didn't yet try to reproduce the diagram in this text. Just run the commands yourself, making sure that you have loaded "PDL::Complex" (and "PDL::Graphics::PGPLOT"). FUNCTIONS
cplx real-valued-pdl Cast a real-valued piddle to the complex datatype. The first dimension of the piddle must be of size 2. After this the usual (complex) arithmetic operators are applied to this pdl, rather than the normal elementwise pdl operators. Dataflow to the complex parent works. Use "sever" on the result if you don't want this. complex real-valued-pdl Cast a real-valued piddle to the complex datatype without dataflow and inplace. Achieved by merely reblessing a piddle. The first dimension of the piddle must be of size 2. real cplx-valued-pdl Cast a complex valued pdl back to the "normal" pdl datatype. Afterwards the normal elementwise pdl operators are used in operations. Dataflow to the real parent works. Use "sever" on the result if you don't want this. r2C Signature: (r(); [o]c(m=2)) convert real to complex, assuming an imaginary part of zero r2C does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. i2C Signature: (r(); [o]c(m=2)) convert imaginary to complex, assuming a real part of zero i2C does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Cr2p Signature: (r(m=2); float+ [o]p(m=2)) convert complex numbers in rectangular form to polar (mod,arg) form. Works inplace Cr2p does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Cp2r Signature: (r(m=2); [o]p(m=2)) convert complex numbers in polar (mod,arg) form to rectangular form. Works inplace Cp2r does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Cmul Signature: (a(m=2); b(m=2); [o]c(m=2)) complex multiplication Cmul does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Cprodover Signature: (a(m=2,n); [o]c(m=2)) Project via product to N-1 dimension Cprodover does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Cscale Signature: (a(m=2); b(); [o]c(m=2)) mixed complex/real multiplication Cscale does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Cdiv Signature: (a(m=2); b(m=2); [o]c(m=2)) complex division Cdiv does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Ccmp Signature: (a(m=2); b(m=2); [o]c()) Complex comparison oeprator (spaceship). It orders by real first, then by imaginary. Hm, but it is mathematical nonsense! Complex numbers cannot be ordered. Ccmp does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Cconj Signature: (a(m=2); [o]c(m=2)) complex conjugation. Works inplace Cconj does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Cabs Signature: (a(m=2); [o]c()) complex "abs()" (also known as modulus) Cabs does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Cabs2 Signature: (a(m=2); [o]c()) complex squared "abs()" (also known squared modulus) Cabs2 does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Carg Signature: (a(m=2); [o]c()) complex argument function ("angle") Carg does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Csin Signature: (a(m=2); [o]c(m=2)) sin (a) = 1/(2*i) * (exp (a*i) - exp (-a*i)). Works inplace Csin does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Ccos Signature: (a(m=2); [o]c(m=2)) cos (a) = 1/2 * (exp (a*i) + exp (-a*i)). Works inplace Ccos does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Ctan a [not inplace] tan (a) = -i * (exp (a*i) - exp (-a*i)) / (exp (a*i) + exp (-a*i)) Cexp Signature: (a(m=2); [o]c(m=2)) exp (a) = exp (real (a)) * (cos (imag (a)) + i * sin (imag (a))). Works inplace Cexp does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Clog Signature: (a(m=2); [o]c(m=2)) log (a) = log (cabs (a)) + i * carg (a). Works inplace Clog does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Cpow Signature: (a(m=2); b(m=2); [o]c(m=2)) complex "pow()" ("**"-operator) Cpow does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Csqrt Signature: (a(m=2); [o]c(m=2)) Works inplace Csqrt does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Casin Signature: (a(m=2); [o]c(m=2)) Works inplace Casin does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Cacos Signature: (a(m=2); [o]c(m=2)) Works inplace Cacos does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Catan cplx [not inplace] Return the complex "atan()". Csinh Signature: (a(m=2); [o]c(m=2)) sinh (a) = (exp (a) - exp (-a)) / 2. Works inplace Csinh does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Ccosh Signature: (a(m=2); [o]c(m=2)) cosh (a) = (exp (a) + exp (-a)) / 2. Works inplace Ccosh does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Ctanh Signature: (a(m=2); [o]c(m=2)) Works inplace Ctanh does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Casinh Signature: (a(m=2); [o]c(m=2)) Works inplace Casinh does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Cacosh Signature: (a(m=2); [o]c(m=2)) Cacosh does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Catanh Signature: (a(m=2); [o]c(m=2)) Works inplace Catanh does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Cproj Signature: (a(m=2); [o]c(m=2)) compute the projection of a complex number to the riemann sphere. Works inplace Cproj does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. Croots Signature: (a(m=2); [o]c(m=2,n); int n => n) Compute the "n" roots of "a". "n" must be a positive integer. The result will always be a complex type! Croots does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. re cplx, im cplx Return the real or imaginary part of the complex number(s) given. These are slicing operators, so data flow works. The real and imaginary parts are returned as piddles (ref eq PDL). rCpolynomial Signature: (coeffs(n); x(c=2,m); [o]out(c=2,m)) evaluate the polynomial with (real) coefficients "coeffs" at the (complex) position(s) "x". "coeffs[0]" is the constant term. rCpolynomial does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. AUTHOR
Copyright (C) 2000 Marc Lehmann <pcg@goof.com>. All rights reserved. There is no warranty. You are allowed to redistribute this software / documentation as described in the file COPYING in the PDL distribution. SEE ALSO
perl(1), PDL. perl v5.14.2 2012-05-30 Complex(3pm)
All times are GMT -4. The time now is 06:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy