Sponsored Content
Top Forums Shell Programming and Scripting String concatenation not working in a loop Post 302389821 by LostInTheWoods on Tuesday 26th of January 2010 03:37:47 AM
Old 01-26-2010
Thanks to you both, I am really glad I joined this forum now Smilie

Works like a charm. A bit of a follow up question though, is it bad practise to change the IFS variable like in the first example?

Thanks again,
LITW
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

string concatenation

my input file contains thousands of lines like below 234A dept of education 9788 dept of commerce 8677 dept of engineering How do i add a delimeter ':' after FIRST 4 CHARACTERS in a line 234A:dept of education 9788:dept of commerce 8677:dept of engineering (7 Replies)
Discussion started by: systemsb
7 Replies

2. Shell Programming and Scripting

String handling is not working inside if loop

Hi All, I am comparing two strings inside an if condition if the strings are same then it should go inside the loop else it should execute code given in else part. But there is a but inside my script Even if the if condition is true it is not going inside the loop also it is executing... (4 Replies)
Discussion started by: usha rao
4 Replies

3. Shell Programming and Scripting

String Concatenation

Hi All, I need to concatenate the values in the array into a variable. Currently the code is : for (( i=1 ; i <= $minCount ; i++ )) do var="${var}""${sample_file}" done The output is : /tmp/1/tmp/2/tmp/3/tmp/4/tmp/5/tmp/6/tmp/7/tmp/8/tmp/9/tmp/10 I need a space between... (1 Reply)
Discussion started by: sh_kk
1 Replies

4. Shell Programming and Scripting

String comparison not working inside while loop

Hi, In the code included below, the string comparision is not working fine. Please help while (( find_out >= i )) do file=`head -$i f.out|tail -1` dir=`dirname $file` cd $dir Status="" if ; then Status=`cvs -Q status... (3 Replies)
Discussion started by: sudvishw
3 Replies

5. Shell Programming and Scripting

string comparison not working inside while loop

The string comparison highlighted below is not working fine. Please help: while read line do # Get File name by deleting everything that preceedes and follows Filename as printed in cvs status' output f_name=`echo $line | sed -e 's/^File://' -e 's/ *Status:.*//' | awk '{print $NF}'` ... (4 Replies)
Discussion started by: sudvishw
4 Replies

6. Shell Programming and Scripting

String concatenation

Hi, I have two files. cat file.txt a b c d cat file1.txt j k l m I need the output as a:j (12 Replies)
Discussion started by: nareshkumar522
12 Replies

7. Shell Programming and Scripting

String concatenation problem

Hi there, I'm writing a basic script where I want to make a string of 2 numeric fields from a file, which I have done, but the behavior is rather confusing. I have a file of random values such as: 1 2 3 4 5 6 7 8 9 10 and my awk code is: BEGIN { FS = " " } { str = str $1 $2 } END {... (7 Replies)
Discussion started by: HMChadwick
7 Replies

8. Shell Programming and Scripting

Concatenation in awk not working

Hello I want to achieve the following. However the concatenation is not working mv `ls -ltr *myfile*.log|awk '{print $9}'` `ls -ltr *myfile*.log|awk '{print `date +'%d%m%y%k%M%S'` $9}'` I tried awk '{x=`date +'%d%m%y%k%M%S'` print $x "" $9}' awk '{x=`date +'%d%m%y%k%M%S'`... (2 Replies)
Discussion started by: Chetanz
2 Replies

9. Shell Programming and Scripting

String variable concatenation through loop problem

Hi Team!! Please can anyone tell me why the following line does not work properly? str3+=$str2 it seems that str3 variable does not keep its value in order to be concatenated in the next iteration! Thus when i print the result of the line above it returns the str2 value What i want to do is to... (8 Replies)
Discussion started by: paladinaeon
8 Replies

10. Shell Programming and Scripting

Help with String concatenation

I have a script which is migrated from AIX to Linux & now while running it is no able to concatenate string values The string concatenation step under while loop is not displaying desired result Please find below the piece of code: while read EXT_FILE ; do EXT_FILE=$EXT_FILE.ext.sent echo... (7 Replies)
Discussion started by: PreetArul
7 Replies
Math(3) 						User Contributed Perl Documentation						   Math(3)

NAME
PDL::Math - extended mathematical operations and special functions SYNOPSIS
use PDL::Math; use PDL::Graphics::TriD; imag3d [SURF2D,bessj0(rvals(zeroes(50,50))/2)]; DESCRIPTION
This module extends PDL with more advanced mathematical functions than provided by standard Perl. All the functions have one input pdl, and one output, unless otherwise stated. The functions are usually available from the system maths library, however if they are not (determined when PDL is compiled) a version from the Cephes math library is used. FUNCTIONS
acos Signature: (a(); [o]b()) The usual trigonometric function. Works inplace. asin Signature: (a(); [o]b()) The usual trigonometric function. Works inplace. atan Signature: (a(); [o]b()) The usual trigonometric function. Works inplace. cosh Signature: (a(); [o]b()) The standard hyperbolic function. Works inplace. sinh Signature: (a(); [o]b()) The standard hyperbolic function. Works inplace. tan Signature: (a(); [o]b()) The usual trigonometric function. Works inplace. tanh Signature: (a(); [o]b()) The standard hyperbolic function. Works inplace. ceil Signature: (a(); [o]b()) Round to integral values in floating-point format. Works inplace. floor Signature: (a(); [o]b()) Round to integral values in floating-point format. Works inplace. rint Signature: (a(); [o]b()) Round to integral values in floating-point format. Works inplace. pow Signature: (a(); b(); [o]c()) Synonym for `**'. Works inplace. acosh Signature: (a(); [o]b()) The standard hyperbolic function. Works inplace. asinh Signature: (a(); [o]b()) The standard hyperbolic function. Works inplace. atanh Signature: (a(); [o]b()) The standard hyperbolic function. Works inplace. erf Signature: (a(); [o]b()) The error function. Works inplace. erfc Signature: (a(); [o]b()) The complement of the error function. Works inplace. bessj0 Signature: (a(); [o]b()) The standard Bessel function. Works inplace. bessj1 Signature: (a(); [o]b()) The standard Bessel function. Works inplace. bessy0 Signature: (a(); [o]b()) The standard Bessel function. Works inplace. bessy1 Signature: (a(); [o]b()) The standard Bessel function. Works inplace. bessjn Signature: (a(); int n(); [o]b()) The standard Bessel function. This has a second integer argument which gives the order of the function required. Works inplace. bessyn Signature: (a(); int n(); [o]b()) The standard Bessel function. This has a second integer argument which gives the order of the function required. Works inplace. lgamma Signature: (a(); [o]b(); int[o]s()) log gamma function This returns 2 piddles -- the first set gives the log(gamma) values, while the second set, of integer values, gives the sign of the gamma function. This is useful for determining factorials, amongst other things. badmask Signature: (a(); b(); [o]c()) Clears all "infs" and "nans" in $a to the corresponding value in $b. badmask can be run with $a inplace: badmask($a->inplace,0); $a->inplace->badmask(0); isfinite Signature: (a(); int [o]mask()) Sets $mask true if $a is not a "NaN" or "inf" (either positive or negative). Works inplace. erfi Signature: (a(); [o]b()) The inverse of the error function. Works inplace. ndtri Signature: (a(); [o]b()) The value for which the area under the Gaussian probability density function (integrated from minus infinity) is equal to the argument (cf erfi). Works inplace. svd Signature: (a(n,m); [o]u(n,m); [o,phys]z(n); [o]v(n,n)) Singular value decomposition of array. ($u, $s, $v) = svd($a); polyroots Signature: (cr(n); ci(n); [o]rr(m); [o]ri(m)) Complex roots of a complex polynomial, given coefficients in order of decreasing powers. ($rr, $ri) = polyroots($cr, $ci); eigens Signature: ([phys]a(m); [o,phys]ev(n,n); [o,phys]e(n)) Eigenvalues and -vectors of a symmetric square matrix. If passed an asymmetric matrix, the routine will warn and symmetrize it. ($e, $ev) = eigens($a); simq Signature: ([phys]a(n,n); [phys]b(n); [o,phys]x(n); int [o,phys]ips(n); int flag) Solution of simultaneous linear equations, "a x = b". $a is an "n x n" matrix (i.e., a vector of length "n*n"), stored row-wise: that is, "a(i,j) = a[ij]", where "ij = i*n + j". While this is the transpose of the normal column-wise storage, this corresponds to normal PDL usage. The contents of matrix a may be altered (but may be required for subsequent calls with flag = -1). $b, $x, $ips are vectors of length "n". Set "flag=0" to solve. Set "flag=-1" to do a new back substitution for different $b vector using the same a matrix previously reduced when "flag=0" (the $ips vector generated in the previous solution is also required). squaretotri Signature: (a(n,n); b(m)) Convert a symmetric square matrix to triangular vector storage BUGS
Hasn't been tested on all platforms to ensure Cephes versions are picked up automatically and used correctly. AUTHOR
Copyright (C) R.J.R. Williams 1997 (rjrw@ast.leeds.ac.uk), Karl Glazebrook (kgb@aaoepp.aao.gov.au) and Tuomas J. Lukka (Tuomas.Lukka@hel- sinki.fi). All rights reserved. There is no warranty. You are allowed to redistribute this software / documentation under certain conditions. For details, see the file COPYING in the PDL distribution. If this file is separated from the PDL distribution, the copyright notice should be included in the file. perl v5.8.0 2003-01-29 Math(3)
All times are GMT -4. The time now is 04:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy