Sponsored Content
Top Forums Shell Programming and Scripting Abnormality while piping tr command output to sed Post 302746495 by chidori on Wednesday 19th of December 2012 01:16:45 PM
Old 12-19-2012
Abnormality while piping tr command output to sed

i have a file seperated each line seperated by newline. For example
Code:
alpha
beta
gamma

i am trying to replace the newlines to "," but dont want , present at the end of the line so i am trying the below one liner . but not sure whats wrong but its not working
cat myfile | tr -s '\n' ',' | sed 's/,$//'

But when i try it this way , its working
echo "alpha,beta,gamma," | sed 's/,$//'

can someone please explain me this behaviour.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Piping output to while read

Hi. Im using cat to output the contents of a file, then piping it to my while read loop.In this loop variables get assigned values. However when i try to use the variables outside the loop their values has been reset.I understand about subshells etc. but I have no idea how to "preserve" the... (3 Replies)
Discussion started by: Ultimodiablo
3 Replies

2. UNIX for Dummies Questions & Answers

piping the output of find command to grep

Hi, I did not understand why the following did not work out as I expected: find . -name "pqp.txt" | grep -v "Permission" I thought I would be able to catch whichever paths containing my pqp.txt file without receiving the display of messages such as "find: cannot access... Permisson... (1 Reply)
Discussion started by: 435 Gavea
1 Replies

3. Shell Programming and Scripting

piping output to echo

Hi, I was wondering why ls * | echo does not print the contents of the directory to the screen? The way I see it, ls * returns a whole lot of information, and then we pipe all this info to echo, so surely it should all come to our screen! Is there a serious flaw in my understanding? ... (3 Replies)
Discussion started by: A1977
3 Replies

4. Shell Programming and Scripting

piping output of tail running in background

Not sure why this does not work in bash: tail -f err.log |& -bash: syntax error near unexpected token `&' I am attempting to continuously read a file that is being updated by doing a "tail -f" on the file and piping the output to stdin which can then be read by the next shell command Thnx (4 Replies)
Discussion started by: anuramdas
4 Replies

5. Shell Programming and Scripting

piping oracle output to a file?

Hi All... Does anyone know how to pipe the output of a "select" statement from a call to Oracle to a file? ANy ideas woule be greatly appreciated! Code is as below... echo "producing CSV file 2..." sqlplus -s $username/$password@$database<<EOF set serveroutput on size 1000000 set... (13 Replies)
Discussion started by: satnamx
13 Replies

6. Shell Programming and Scripting

Piping and assigning output to a variable in Perl

Hi All, I am trying to convert the below Csh code into Perl. But i have the following error. Can any expert help ? Error: ls: *tac: No such file or directory Csh set $ST_file = `ls -rt *$testid*st*|tail -1`; Perl my $ST_file = `ls -rt *$testid*st*|tail -1`; (10 Replies)
Discussion started by: Raynon
10 Replies

7. Shell Programming and Scripting

Piping output from a command into bash script

Hi all. I am using procmail to deliver an email to a script I am developing. Procmail delivers the email to the script on standard input. I imagine this is the same as piping input from a command into the script. Hence I've been testing my script by running echo 'test' | sms-autosend-backup.sh ... (2 Replies)
Discussion started by: akindo
2 Replies

8. Shell Programming and Scripting

need help piping the output from an app... uh, yeah...

Ok, so there is a perl script that runs as a server, on my local host. It tells me which port to use. I want to pipe that output into my browser so I can do the whole thing with a single command. The problem is, I think, that the program doesn't actually exit cause it's running a server, so...... (6 Replies)
Discussion started by: ninjaaron
6 Replies

9. Shell Programming and Scripting

Piping output of ls to a text file

Basically I was wondering if any of you know how to pipe the output of ls to a text file? so in my shell script one of the lines is ls but i want to pipe it into a file called directory listing. Cheers. I have tried ls | Directorylisting.txt but it keeps saying " line 7: DirectoryListing.txt:... (9 Replies)
Discussion started by: LinuxNubBrah
9 Replies

10. UNIX for Beginners Questions & Answers

Facing abnormality in Find command

Whenever the below command is being executed by a scheduler at UNIX environment, we are getting below error cd /tmp/log find . -ignore_readdir_race ! -name . -prune -iname 'XYZ*' -type f -mtime +4 -printf "%f\n" ./tmpfile.script_name.2.31885.201906071336.tmp': No such file or directory... (2 Replies)
Discussion started by: Anirban2208
2 Replies
zlagtm.f(3)							      LAPACK							       zlagtm.f(3)

NAME
zlagtm.f - SYNOPSIS
Functions/Subroutines subroutine zlagtm (TRANS, N, NRHS, ALPHA, DL, D, DU, X, LDX, BETA, B, LDB) ZLAGTM Function/Subroutine Documentation subroutine zlagtm (characterTRANS, integerN, integerNRHS, double precisionALPHA, complex*16, dimension( * )DL, complex*16, dimension( * )D, complex*16, dimension( * )DU, complex*16, dimension( ldx, * )X, integerLDX, double precisionBETA, complex*16, dimension( ldb, * )B, integerLDB) ZLAGTM Purpose: ZLAGTM performs a matrix-vector product of the form B := alpha * A * X + beta * B where A is a tridiagonal matrix of order N, B and X are N by NRHS matrices, and alpha and beta are real scalars, each of which may be 0., 1., or -1. Parameters: TRANS TRANS is CHARACTER*1 Specifies the operation applied to A. = 'N': No transpose, B := alpha * A * X + beta * B = 'T': Transpose, B := alpha * A**T * X + beta * B = 'C': Conjugate transpose, B := alpha * A**H * X + beta * B N N is INTEGER The order of the matrix A. N >= 0. NRHS NRHS is INTEGER The number of right hand sides, i.e., the number of columns of the matrices X and B. ALPHA ALPHA is DOUBLE PRECISION The scalar alpha. ALPHA must be 0., 1., or -1.; otherwise, it is assumed to be 0. DL DL is COMPLEX*16 array, dimension (N-1) The (n-1) sub-diagonal elements of T. D D is COMPLEX*16 array, dimension (N) The diagonal elements of T. DU DU is COMPLEX*16 array, dimension (N-1) The (n-1) super-diagonal elements of T. X X is COMPLEX*16 array, dimension (LDX,NRHS) The N by NRHS matrix X. LDX LDX is INTEGER The leading dimension of the array X. LDX >= max(N,1). BETA BETA is DOUBLE PRECISION The scalar beta. BETA must be 0., 1., or -1.; otherwise, it is assumed to be 1. B B is COMPLEX*16 array, dimension (LDB,NRHS) On entry, the N by NRHS matrix B. On exit, B is overwritten by the matrix expression B := alpha * A * X + beta * B. LDB LDB is INTEGER The leading dimension of the array B. LDB >= max(N,1). Author: Univ. of Tennessee Univ. of California Berkeley Univ. of Colorado Denver NAG Ltd. Date: November 2011 Definition at line 145 of file zlagtm.f. Author Generated automatically by Doxygen for LAPACK from the source code. Version 3.4.1 Sun May 26 2013 zlagtm.f(3)
All times are GMT -4. The time now is 06:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy