08-09-2016
@rdrtx1: Interesting solution. Took some seconds to get it
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I have the following to remove spaces from beginning and end of a string.
infile=`echo "$infilename" | sed 's/^ *//;s/ *$//`
How do I modify the above code to remove spaces from beginning, end and in the middle of the string also.
ex:
... (4 Replies)
Discussion started by: radhika
4 Replies
2. Shell Programming and Scripting
dear pro-coders,
is there any command out there that takes out the front spaces from a string?
sample strings:
4 members
5 members
3 members
but it has to be like so:
4 members
5 members
3 members (3 Replies)
Discussion started by: pseudocoder
3 Replies
3. UNIX for Dummies Questions & Answers
Hi, all,
I wonder if I can use sed to insert a string which has a colon.
I have a txt file a.txt like the following
TRAIN/DR1/FCJF0/SI1027.MFC
TRAIN/DR1/FCJF0/SI1657.MFC
I want to insert a string C:/TIMIT/TIMIT at the begining of each line.
I use the commond:
TIM=C\:/TIMIT/TIMIT... (2 Replies)
Discussion started by: Jenny.palmy
2 Replies
4. Shell Programming and Scripting
Hi
I have an XML file with strings XABCD, XEFGHX and XIJKLX. I would like to replace XABCDX with "This is the first string", XEFGHX with "This is the second string" and XIJKLX with "This is the third string".
What is the best way to implement this? Should I have a file with the data that is... (4 Replies)
Discussion started by: zmfcat1
4 Replies
5. Shell Programming and Scripting
Hi,
i call my shell like:
my_shell "my project name"
my script:
#!/bin/bash -vx
projectname=$1
sed s/'PROJECT_NAME ='/'PROJECT_NAME = '$projectname/ <test_config_doxy >temp
cp temp test_config_doxy
the following error occurres:
sed s/'PROJECT_NAME ... (2 Replies)
Discussion started by: vivelafete
2 Replies
6. Shell Programming and Scripting
Hi Experts,
I wish to insert predefined text in front of every line and this needs to be in a loop because it is always expanding.
Before :
11111111
22222222
33333333
44444444
55555555
77777777
88888888
00000000
To be Inserted :
a=
b= (2 Replies)
Discussion started by: masayangbata
2 Replies
7. UNIX for Dummies Questions & Answers
Hi:
I have 2 files: teststring.txt and a tempfile.txt
teststring file contains:
s/Primary Ins./\n1/g
I'm trying to search for "Primary Ins." string in tempfile. For every "Primary Ins." string that is found, a new line is inserted and put in number 1. Then, write out the newfile... (7 Replies)
Discussion started by: newbeee
7 Replies
8. Shell Programming and Scripting
Solaris, ksh
I have a .csv file I am trying to clean up before loading into the database. The file contains comma separated columns that have leading spaces which I need to remove. The trouble is, some columns that should not be touched are strings which happen to have the same pattern in them. ... (4 Replies)
Discussion started by: gary_w
4 Replies
9. Shell Programming and Scripting
Hello Gurus,
I wanted to put a single quote in every where starting with /oradata, and at the end with .dbf.
For example I have one line as below:
alter database rename datafile /oradata/test.dbf to /oradata_new/test.dbf I wanted as below
alter database rename datafile '/oradata/test.dbf' to... (3 Replies)
Discussion started by: pokhraj_d
3 Replies
10. Shell Programming and Scripting
Hello,
Just surfed on the web for probable answers but could not get them working.
I wish to replace the string containing spaces by another phrase but below answers did not work.
My string is:
PAIN & GAIN
I wish to convert it to:
P&G
I just need it working with sed with function -i
... (6 Replies)
Discussion started by: baris35
6 Replies
LEARN ABOUT REDHAT
cpprfs
CPPRFS(l) ) CPPRFS(l)
NAME
CPPRFS - improve the computed solution to a system of linear equations when the coefficient matrix is Hermitian positive definite and
packed, and provides error bounds and backward error estimates for the solution
SYNOPSIS
SUBROUTINE CPPRFS( UPLO, N, NRHS, AP, AFP, B, LDB, X, LDX, FERR, BERR, WORK, RWORK, INFO )
CHARACTER UPLO
INTEGER INFO, LDB, LDX, N, NRHS
REAL BERR( * ), FERR( * ), RWORK( * )
COMPLEX AFP( * ), AP( * ), B( LDB, * ), WORK( * ), X( LDX, * )
PURPOSE
CPPRFS improves the computed solution to a system of linear equations when the coefficient matrix is Hermitian positive definite and
packed, and provides error bounds and backward error estimates for the solution.
ARGUMENTS
UPLO (input) CHARACTER*1
= 'U': Upper triangle of A is stored;
= 'L': Lower triangle of A is stored.
N (input) INTEGER
The order of the matrix A. N >= 0.
NRHS (input) INTEGER
The number of right hand sides, i.e., the number of columns of the matrices B and X. NRHS >= 0.
AP (input) COMPLEX array, dimension (N*(N+1)/2)
The upper or lower triangle of the Hermitian matrix A, packed columnwise in a linear array. The j-th column of A is stored in the
array AP as follows: if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j; if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for
j<=i<=n.
AFP (input) COMPLEX array, dimension (N*(N+1)/2)
The triangular factor U or L from the Cholesky factorization A = U**H*U or A = L*L**H, as computed by SPPTRF/CPPTRF, packed column-
wise in a linear array in the same format as A (see AP).
B (input) COMPLEX array, dimension (LDB,NRHS)
The right hand side matrix B.
LDB (input) INTEGER
The leading dimension of the array B. LDB >= max(1,N).
X (input/output) COMPLEX array, dimension (LDX,NRHS)
On entry, the solution matrix X, as computed by CPPTRS. On exit, the improved solution matrix X.
LDX (input) INTEGER
The leading dimension of the array X. LDX >= max(1,N).
FERR (output) REAL array, dimension (NRHS)
The estimated forward error bound for each solution vector X(j) (the j-th column of the solution matrix X). If XTRUE is the true
solution corresponding to X(j), FERR(j) is an estimated upper bound for the magnitude of the largest element in (X(j) - XTRUE)
divided by the magnitude of the largest element in X(j). The estimate is as reliable as the estimate for RCOND, and is almost
always a slight overestimate of the true error.
BERR (output) REAL array, dimension (NRHS)
The componentwise relative backward error of each solution vector X(j) (i.e., the smallest relative change in any element of A or B
that makes X(j) an exact solution).
WORK (workspace) COMPLEX array, dimension (2*N)
RWORK (workspace) REAL array, dimension (N)
INFO (output) INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value
PARAMETERS
ITMAX is the maximum number of steps of iterative refinement.
LAPACK version 3.0 15 June 2000 CPPRFS(l)