Sponsored Content
Top Forums Shell Programming and Scripting Abnormality while piping tr command output to sed Post 302746499 by Scott on Wednesday 19th of December 2012 01:26:44 PM
Old 12-19-2012
Based exactly on your input file, it works for me. What is not working about it for you?

Code:
$ tr -s '\n' ',' < file | sed 's/,$//'    
alpha,beta,gamma

(no need for cat, though)

You can also use paste
Code:
$ paste -sd, file                     
alpha,beta,gamma

At a wild guess, I would say your file has ^M characters in it.

Show the output of:
Code:
cat -v infile

This User Gave Thanks to Scott For This Post:
 

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
pngtopnm(1)                                                   General Commands Manual                                                  pngtopnm(1)

NAME
pngtopnm - convert a Portable Network Graphics file into portable anymap SYNOPSIS
pngtopnm [-verbose] [-alpha | -mix] [-background color] [-gamma value] [-text file] [-time] [pngfile] DESCRIPTION
Reads a Portable Network Graphics as input. Produces a portable anymap as output. The type of the output file depends on the input file - if it's black & white, a pbm file is written, else if it's grayscale a pgm file, else a ppm file. OPTIONS
-verbose Display the format of the input file and the type of the output file. If the chunks are part of the png-file, the alpha, trans- parency and gamma-values will be indicated. -alpha Output the alpha channel or transparency mask of the image. The result is either a pbm file or pgm file, depending on whether dif- ferent levels of transparency appear. -mix Compose the image with the transparency or alpha mask against a the background. When a background chunk is available that color is taken, else black will do. -background color If no background color chunck is present in the png-file, or when another color is required this parameter can be used to set the background color of images. This is especially useful for alpha-channel images or those with transparency chunks. The format, to specify the color in, is either (in the case of orange) "1.0,0.5,0.0", where the values are floats between zero and one, or with the syntax "#RGB", "#RRGGBB" or "#RRRRGGGGBBBB" where R, G and B are hexa-decimal numbers. -gamma value Converts the image to a new display-gamma value. When a gAMA chunk is present in the png-file, the image-gamma value will be used. When not, the image-gamma is considered to be 1.0. Based on the image-gamma and the display-gamma given with this option the colors written to the pnm-file will be adjusted. Because the gamma's of uncompensated monitors are around 2.6, which results in an image-gamma of 0.45, some typical situations are: when the image-gamma is 0.45 (use -verbose to check) and the picture is too light, your system is gamma-corrected, so convert with "-gamma 1.0". When no gAMA chunk is present or the image-gamma is 1.0, use 2.2 to make the picture lighter and 0.45 to make the picture darker. -text file Writes the tEXt and zTXt chunks to a file, in a format as described in the pnmtopng man-page. These chunks contain text comments or annotations. -time Prints the tIME chunk to stderr. All flags can be abbreviated to their shortest unique prefix. SEE ALSO
pnmtopng(1), ptot(1), pnmgamma(1), pnm(5) NOTE
Instead of pngtopnm|pnmtoxxx, a specific converter should be used, if available. E.g. ptot (PNG to TIFF conversion), etc. BUGS
There could be an option to read the comment text from pnm comments instead of a separate file. The program could be much faster, with a bit of code optimizing. AUTHORS
Copyright (C) 1995-1997 by Alexander Lehmann and Willem van Schaik. 6 January 1997 pngtopnm(1)
All times are GMT -4. The time now is 02:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy