LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
 
Search this Thread
Old 04-04-2014, 05:43 AM   #1
pr0xibus
Member
 
Registered: Apr 2004
Posts: 100

Rep: Reputation: 15
Columns


Morning guys

I have a script that creates id's and passwords separated by a white space

xxxxxxxx xxxxxxxx
yyyyyyyy yyyyyyyy


now when i transfer the file from linux too windows and i copy the id's and password into excel it will just copy it into the 1st column only. is their any way round this?
 
Old 04-04-2014, 05:48 AM   #2
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 5,609

Rep: Reputation: Disabled
Your Excel stumbles over the missing DOS line endings.

Before transferring your file from Linux to Windows, run this command on the file to add DOS line endings:
Code:
sed -i 's/$/\r/' your_file
Eric
 
Old 04-04-2014, 06:10 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 12,756

Rep: Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985
In addition you need to specify with Excel what to use as a column separator.

You could also use sed to replace the space with a comma or tab. Excel will automatically open csv files and tab extension files. However, if there are passwords with spaces then you will have problems.
 
Old 04-04-2014, 06:13 AM   #4
pr0xibus
Member
 
Registered: Apr 2004
Posts: 100

Original Poster
Rep: Reputation: 15
Hello Alien Bob

So once running that command on the file and transferring the txt / docx / xlsx over to windows, i then open the file and copy to another excel / docx and it will still copy the entire line as one rather than just copying the username or password
 
Old 04-04-2014, 06:35 AM   #5
Mark Pettit
Member
 
Registered: Dec 2008
Location: Cape Town, South Africa
Distribution: Slackware 14.1 64 Multi-Lib
Posts: 457

Rep: Reputation: 143Reputation: 143
You are generating the file with spaces between the fields. Just try to generate the file with a comma between the 2 fields.
So, don't do "xxxxxxx yyyyyyyy" - rather do "xxxxxxxx,yyyyyyy".
The excel should import perfectly fine. Assuming the line-ending is cr-lf (as AlienBob suggests).
 
Old 04-04-2014, 06:40 AM   #6
pr0xibus
Member
 
Registered: Apr 2004
Posts: 100

Original Poster
Rep: Reputation: 15
Hello

Cheers for the reply,

Unfortunately the script that we use for creating ID's is pretty old and No-one can re-write the script YET. Just trying too make it easier for the guys using the script. The ID's and pass cant be changed for the time being with a , between them. Once the script has done its job it will output the passwords too password.dat which we then convert too docx just curious if we could input a , before converting then run the command alien bob suggest then convert too .csv instead.

Last edited by pr0xibus; 04-04-2014 at 06:47 AM.
 
Old 04-04-2014, 06:58 AM   #7
allend
Senior Member
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 3,822

Rep: Reputation: 1013Reputation: 1013Reputation: 1013Reputation: 1013Reputation: 1013Reputation: 1013Reputation: 1013Reputation: 1013
Two ways to go after the conversion that Alien Bob suggested.
1. Run the file through
Code:
 tr ' ' ','
to translate the space to comma
2. Load the file into Excel as a .txt file and choose Space as the delimiter.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Converting a file with Rows and Columns to just Columns mphillips67 Linux - Newbie 14 03-05-2014 10:31 AM
[SOLVED] bash suggestions to convert horizontal columns to vertical columns Guyverix Programming 14 01-24-2013 11:03 AM
SQL statements howto -- 3 columns input but 2 columns output fhleung Programming 3 11-29-2012 10:45 AM
Map 1 CSV's columns to matching columns in another CSV 2legit2quit Programming 7 10-27-2011 08:53 AM
[SOLVED] AWK: add columns while keep format for other columns cristalp Programming 3 10-13-2011 06:14 AM


All times are GMT -5. The time now is 09:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration