Register
It is currently Sun Sep 21, 2014 8:10 pm

Processing an csv file


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Wed May 07, 2014 6:56 pm   

Joined: Wed May 07, 2014 6:42 pm
Posts: 1
Hello Everybody,

i'm trying to process an csv-File wich is created by perl script xlsx2csv V0.11.

i read the file with a while loop. While i was trying to split the line using the build in command

fileline={ ${fileline//[,]/ } );

i got the problem, that i could not use the last column. I thought that it might be the newline Command inside the csv file, so i tried to show the whole line like this bevor splitting

Code:

while read fileline
        do
              echo " "
              fileline="${fileline%\\n}";
              echo -n "******";
              echo -n "$fileline";
              echo "*****";
         done < test.csv


The Result in the console was

******ABCD

the Ending ****** where missing while the next line showed up normally.

Does anybody has an idea how to get ride of this problem?

Thanks for any help

Steve


Top
 Profile  
 PostPosted: Thu May 08, 2014 2:22 am   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 548
hi,

your file is probably in DOS format, you have to convert it into UNIX format, using fromdos command.


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP