replace comma(,) with Tab | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


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

replace comma(,) with Tab

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 11-14-2008
vikas_kesarwani vikas_kesarwani is offline
Registered User
 
Join Date: Jul 2008
Last Activity: 9 June 2010, 9:14 AM EDT
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Error replace comma(,) with Tab

hi all,

i have a file with commas(,). i want to replace all the commas with tab(\t).

Plz help...its urgent...
Sponsored Links
    #2  
Old 11-14-2008
divzz's Avatar
divzz divzz is offline
Registered User
 
Join Date: Mar 2008
Last Activity: 27 May 2013, 6:09 AM EDT
Location: Bangalore
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
awk 'BEGIN { FS=","; OFS=" " }
{print $0}' input
Sponsored Links
    #3  
Old 11-14-2008
labrazil labrazil is offline
Registered User
 
Join Date: Sep 2008
Last Activity: 14 November 2008, 3:30 AM EST
Location: San Diego, CA
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts

Code:
sed 's/,/\t/g' filename

see if that helps.
    #4  
Old 11-14-2008
dennis.jacob's Avatar
dennis.jacob dennis.jacob is offline Forum Advisor  
Registered User
 
Join Date: Feb 2007
Last Activity: 30 March 2014, 9:33 AM EDT
Location: Singapore/Cochin
Posts: 871
Thanks: 0
Thanked 12 Times in 11 Posts
Try tr command


Code:
echo $var | tr ',' '\t'

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Replace newline with comma. Jotne Shell Programming and Scripting 7 01-16-2011 02:57 AM
Replace the | with Comma bharathappriyan Shell Programming and Scripting 6 11-10-2010 08:13 PM
Replace comma with newline eltinator Shell Programming and Scripting 1 02-11-2009 05:04 PM
vi or vim replace ,$ (eol) with just a comma dbauhaus UNIX and Linux Applications 6 10-02-2008 09:02 AM
Replace , (comma) with space mbarberis Shell Programming and Scripting 6 03-29-2005 09:35 AM



All times are GMT -4. The time now is 07:28 PM.