|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi,
I have a simple file with one number per line and would like to covert it to a single line where each number is separated by a comma. Input: .... 423 5 567 12 46 Output: ...., 423,5,567,12,46 Is this possible using standard shell commands? I've tried to "tr \n ," but without success. Thanks in advance, -- Sérgio Nunes |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Wed, 18 Jul 2007 11:23:39 -0700, ssn wrote:
> Hi, > > I have a simple file with one number per line and would like to covert > it to a single line where each number is separated by a comma. > > Input: > ... > 423 > 5 > 567 > 12 > 46 > > Output: > ..., 423,5,567,12,46 > > Is this possible using standard shell commands? > I've tried to "tr \n ," but without success. > > Thanks in advance,tr Put the strings in quotes.... tr "\n" "," < inputfile > outputfile stonerfish |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
In article <1184783019.375187.172430@d30g2000prg.googlegroups .com>,
ssn <snunes@gmail.com> wrote: >Hi, > >I have a simple file with one number per line and would like to covert >it to a single line where each number is separated by a comma. > >Input: >... >423 >5 >567 >12 >46 > >Output: >..., 423,5,567,12,46 > >Is this possible using standard shell commands? >I've tried to "tr \n ," but without success. echo '1,$j|s/ /,/g\nx\n' | ex - yourfile |
|
![]() |
| Outils de la discussion | |
|
|