The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
vi or vim replace ,$ (eol) with just a comma dbauhaus UNIX and Linux Applications 6 4 Days Ago 06:02 AM
Split by comma mahalakshmi Shell Programming and Scripting 2 12-18-2006 04:16 AM
Comma seperator premar Shell Programming and Scripting 6 02-17-2006 12:16 AM
add comma alisevA3 UNIX for Dummies Questions & Answers 3 10-18-2002 06:29 AM
Add a comma at end of every line ST2000 Shell Programming and Scripting 4 07-14-2002 03:49 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-10-2007
Registered User
 

Join Date: Aug 2007
Posts: 14
Stumble this Post!
Replacing Comma by Tab

Hi All,

i have a file test.txt as shown below,

1,test,test111
2,rest,rest222

i want to replace the commas by tab delimiter..,

it should be like,

1 test test111
2 rest rest222

i tried the following code,

Code:
sed 's/,/\\t/g' test.txt >> ouptut.txt
But, that dint work..,

Could any one help?

Thanks
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 09-10-2007
Registered User
 

Join Date: Sep 2006
Posts: 1,537
Stumble this Post!
use double quotes
Reply With Quote
  #3 (permalink)  
Old 09-10-2007
Registered User
 

Join Date: Aug 2007
Posts: 14
Stumble this Post!
Hi -

i have used double quotes.., but, it dint work.
Reply With Quote
  #4 (permalink)  
Old 09-10-2007
Registered User
 

Join Date: Aug 2007
Posts: 45
Stumble this Post!
sed "s/\,/\\t/g"test.txt >> ouptut.txt
Reply With Quote
  #5 (permalink)  
Old 09-10-2007
Registered User
 

Join Date: Aug 2007
Posts: 14
Stumble this Post!
Fazil -

that dint work..,
Reply With Quote
  #6 (permalink)  
Old 09-10-2007
Registered User
 

Join Date: Aug 2007
Posts: 14
Stumble this Post!
Hi All -

I have used the below code..,

Code:
sed 's/,/<<press tab>>/g' test.txt > output.txt
And that did the click!!! Thank u all 4 helping
Reply With Quote
  #7 (permalink)  
Old 09-10-2007
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,658
Stumble this Post!
Code:
tr ',' '\t' < in.txt > out.txt
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:52 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0