The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
replace comma(,) with Tab vikas_kesarwani Shell Programming and Scripting 3 11-14-2008 02:15 AM
vi or vim replace ,$ (eol) with just a comma dbauhaus UNIX and Linux Applications 6 10-02-2008 09:02 AM
How to replace all entries of comma in text file by space or other character prashant43 Shell Programming and Scripting 4 08-30-2008 12:53 AM
replace space with delimiter in whole file -perl meghana Shell Programming and Scripting 11 02-19-2008 09:35 PM
Replace , (comma) with space mbarberis Shell Programming and Scripting 6 03-29-2005 10:35 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-02-2009
pritish.sas pritish.sas is offline
Registered User
  
 

Join Date: Dec 2008
Location: Mumbai
Posts: 44
replace space with comma in perl

arr_Ent_NameId variable holds 'Prakash pawar' 'sag' '23' '50000' this value
Code:
'Prakash pawar' 'sag' '23' '50000'
I want to replace space( ) with comma (,)

There are 4 fields here. I don't want to replace first field with comma.

output should be:
Code:
'Prakash,pawar','sag','23','50000'
Thanks
Pritish

---------- Post updated at 07:28 PM ---------- Previous update was at 07:16 PM ----------

Would you pls help me out.

Last edited by Yogesh Sawant; 07-05-2009 at 09:53 AM.. Reason: added code tags
  #2 (permalink)  
Old 07-02-2009
Ramesh_srk Ramesh_srk is offline
Registered User
  
 

Join Date: Jun 2009
Location: Chennai,India
Posts: 20
Try this in perl,
Code:
qx/printf $arr_Ent_NameId | sed 's/ /,/g'/;

Last edited by Yogesh Sawant; 07-05-2009 at 09:54 AM.. Reason: added code tags
  #3 (permalink)  
Old 07-03-2009
prasperl prasperl is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 22
Try this

s/\s/,/g;
Sponsored Links
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 12:29 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0