AUTHOR

Any unix experts here

I have a list of words with spaces in them..would like to substitute the spaces with commas
these words are horizontal, not vertical so i cant use awk
maintain space with comma or replace space with comma?
replace with
either way, are you familiar with sed?
we all are. Java, C, C++,C#,PHP,Python,Objective-C,Perl,JavaScript,Lisp,Ada certified
sed -e 's/[[:space:]]+/,/g

bye.
voltaic quote:
sed -e 's/[[:space:]]+/,/g

bye.
I actually used sed s/\ /,/g oldfile >newfile
voltaic quote:
sed -e 's/[[:space:]]+/,/g

bye.
gonan try, if it doesnt work, die
suresh quote:
gonan try, if it doesnt work, die
mine worky too fyi
Louis2rich quote:
I actually used sed s/\ /,/g oldfile >newfile
Smiley
Louis2rich quote:
mine worky too fyi
$ cat test
a b c d e f g h i j k l m n o p
$ sed s/\ /,/g test >test1
$ cat test1
a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p
Louis2rich quote:
mine worky too fyi
not working ;/
suresh quote:
not working ;/
that's unfortunate Smiley
sed 's/[ ]\+/,/g'
voltaic quote:
sed 's/[ ]\+/,/g'
tryin
sed 's/[ >\+/,/g' vmfail.out
epo-pou-01 rsm-pou-01 tpm-pou-01 UI1PAWB004E UI1P1AP001E UI1T1AP003X UI1T1AP004X UI1T1AP005X UI1T1DB002X dc-pou-01 pttm-pou-01 rsm-pou-02 rsm-pou-03 serp-pou-01 UI1PAWB013X UI1PAAP001E UI1PAAP002E UI1PAAP003E UI1PAAP004E ui1paap005e UI1PAAP006E UI1PAWB001E UI1PAWB002E UI1PAWB003E tpm-pou-01 tpm-pou-01 serp-pou-01 ui1paap005e UI1PAAP006E ui1pawb001e ui1paap005e UI1PAAP001E
the > is actually sed 's/[ >
fck

use Modern::Perl;
use Tie::File;

my @tied_array;

tie @tied_array, 'Tie::File', 'test.txt', autochomp => 1;

s/\s+/,/g for @tied_array;


nom nom nom

Quick reply

Sign in to post a message.
Smileys

Times shown in Eastern Time (ET).