On Mar 12, 2004, at 3:19 PM, Distribution Lists wrote:

Thanks but I've that already try that

C:\temp>perl -pi.bak -e "s/\s+/,/g" tempfile.out

Add the -l switch to that to chomp the newline and replace it when it prints:


perl -pli.bak -e "s/\s+/,/g" tempfile.out

James

C:\temp>more < tempfile.out
Server,Drive,FSTYPE,Size,Free,Used,SERVER1,C$,NTFS,4095,296,3799,SERVER 1,D$,NTFS,4001,1908,2093,SERVER1,C$,NTFS,38123,29808,8315,


The only thing that is missing this the new line after field 6

So that it will come out like this

Server,Drive,FSTYPE,Size,Free,Used
SERVER1,C$,NTFS,4095,296,3799
SERVER2,D$,NTFS,4001,1908,2093
SERVER3,C$,NTFS,38123,29812,8315


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to