The UNIX and Linux Forums  

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
How to generate a pipe ( | ) delimited file? anushree.a Shell Programming and Scripting 5 10-15-2008 03:35 AM
How to split pipe delimited file njgirl Shell Programming and Scripting 4 06-18-2008 06:15 PM
how to convert Fixed length file to delimited file. satyam_sat Shell Programming and Scripting 7 04-03-2008 03:41 AM
splitting a pipe delimited file in unix ddedic Shell Programming and Scripting 4 03-20-2007 01:16 AM
Grep for NULL in a pipe delimited file sureshg_sampat Shell Programming and Scripting 5 11-21-2006 06:15 AM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 02-12-2009
lehmanbrothers lehmanbrothers is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 3
Convert CSV file (with double quoted strings) to pipe delimited file

Hi,

I want to convert a CSV file to pipe delimited file, in Unix shell command. Most of the string and date fields will be in double quotes.
Ideally, want to do it with single sed command. If not possible then, with minimum possible commands on Unix command prompt (using all possible things like sed, awk etc etc)
Don't want to write a Perl script.

E.g. if input line is

100,"ksjdh",20,,"19-Jan-2009","my,name,is,",0

That should become

100|ksjdh|20||19-Jan-2009|my,name,is,|0

All commas inside double quotes should be there. Blank fields may or may not have double quotes. Numbers will not have double quotes.

Can anybody please help.

Thanks in advance.
 

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 06:03 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