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 > 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
Convert CSV file (with double quoted strings) to pipe delimited file lehmanbrothers Shell Programming and Scripting 11 02-13-2009 01:14 PM
how to convert Fixed length file to delimited file. satyam_sat Shell Programming and Scripting 7 04-03-2008 02:41 AM
Searching for text in a Space delimited File andyblaylock UNIX for Dummies Questions & Answers 6 11-27-2007 07:33 PM
Converting a Delimited File to Fixed width file raghavan.aero Shell Programming and Scripting 2 06-06-2007 02:44 PM
Converting Tab delimited file to Comma delimited file in Unix charan81 Shell Programming and Scripting 22 01-20-2006 09:24 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 02-20-2009
jeevs81 jeevs81 is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 10
Exclamation Converting Space delimited file to Tab delimited file

Hi all,

I have a file with single white space delimited values, I want to convert them to a tab delimited file.

I tried sed, tr ... but nothing is working.

Thanks,
Rajeevan D
  #2 (permalink)  
Old 02-20-2009
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,122
what exactly did you try?
  #3 (permalink)  
Old 02-20-2009
Ikon's Avatar
Ikon Ikon is offline Forum Advisor  
Registered User
  
 

Join Date: Jul 2008
Location: Phoenix, Arizona
Posts: 669
Try this:

Code:
 # cat test.log
1 2 3 4
a b c d
ased asd fff

# sed 's/ /\t/g' test.log
1       2       3       4
a       b       c       d
ased    asd     fff
  #4 (permalink)  
Old 02-20-2009
mr.perffect mr.perffect is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 3
maybe i'm misreading your question but would unexpand work for you?
  #5 (permalink)  
Old 02-20-2009
treesloth treesloth is offline
Registered User
  
 

Join Date: Oct 2008
Location: Orem, Utah
Posts: 73
Quote:
Originally Posted by Ikon View Post
Try this:

Code:
 # cat test.log
1 2 3 4
a b c d
ased asd fff

# sed 's/ /\t/g' test.log
1       2       3       4
a       b       c       d
ased    asd     fff
On my system (FreeBSD 6.3), that converted:

Quote:
1 2 3 4 5
a s d f g
as df gh jk
blah!
into:

Quote:
1t2t3t4t5
atstdtftg
astdftghtjk
blah!
However...

Code:
cat file | tr ' ' '\t'
... worked. Chalk it up to the vagaries of different UNIX systems. I guess.
  #6 (permalink)  
Old 02-23-2009
jeevs81 jeevs81 is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 10
Unhappy Still same problem

360200tFY10tFEB-LTFt500420t12t0
460213tFY09tFEB-LTFt500420t09t15000
460213tFY09tFEB-LTFt500420t10t15000
077426tFY10tFEB-LTFt550200t12t0
077426tFY11tFEB-LTFt550200t12t0
677120tFY09tFEB-LTFt550200t07t57
677120tFY09tFEB-LTFt550200t09t57.5
977120tFY09tFEB-LTFt550200t06t561.5
477717tFY10tFEB-LTFt550200t12t0
577000tFY09tFEB-LTFt550200t12t327
577050tFY09tFEB-LTFt550200t08t86

cat file | tr ' ' '\t'

When I use this, I get the above result.
  #7 (permalink)  
Old 02-23-2009
jeevs81 jeevs81 is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 10
I'm getting "t" as a delimiter rather than a tab
Closed Thread

Bookmarks

Tags
convert, space delimited file, tab delimited file

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 04:38 PM.


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