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
Back-to-Back Connection using HBAs aldowsary IP Networking 3 11-28-2008 10:21 PM
back to back printing in UNIX amirthraj_12 AIX 3 05-06-2008 08:42 AM
converting hex to dec aismann Shell Programming and Scripting 4 02-26-2008 05:51 AM
sed converting / to \/ sakthi.abdullah UNIX for Advanced & Expert Users 8 12-14-2006 03:56 AM
Converting %## back to special characters from an HTML form 98_1LE Shell Programming and Scripting 1 01-14-2006 11:30 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-04-2008
doubleminus doubleminus is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 27
Converting csv to tsv and back

Anyone have a simple UNIX script to look at for doing this? I'm interested in how to convert from csv to tsv, and then back again, if I want to.

Thanks!
  #2 (permalink)  
Old 05-04-2008
fabtagon fabtagon is offline
Registered User
  
 

Join Date: Apr 2008
Location: European Union/Germany
Posts: 189
man sed

hint: escape sequence for tab is \t
  #3 (permalink)  
Old 05-04-2008
doubleminus doubleminus is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 27
Thanks.

When I do: sed 's/,/\t/g' test
it doesn't go to tabbed. It just eliminates spaces...?
  #4 (permalink)  
Old 05-04-2008
fabtagon fabtagon is offline
Registered User
  
 

Join Date: Apr 2008
Location: European Union/Germany
Posts: 189
Your pattern is right. It should work as expected (and does here on Linux, just tested). Use like

Code:
cat file.csv | sed 's/,/\t/g' > file.tsv

  #5 (permalink)  
Old 05-04-2008
Franklin52 Franklin52 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,350
Older versions of sed don't recognize \t as a tab, type ctrl-m and a tab instead of \t.

Regards
  #6 (permalink)  
Old 05-04-2008
doubleminus doubleminus is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 27
Hmmm, I have the latest version of OS X Leopard and am using BASH...but I'm guessing that may have nothing to do with what sed version I'm running? (Sorry, quite new to this).
Closed Thread

Bookmarks

Tags
linux

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 08:37 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
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