Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 04-04-2014, 05:43 AM   #1
Registered: Apr 2004
Posts: 113

Rep: Reputation: 20

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: 6,247

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:
sed -i 's/$/\r/' your_file
Old 04-04-2014, 06:10 AM   #3
Registered: Aug 2002
Posts: 14,524

Rep: Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441
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
Registered: Apr 2004
Posts: 113

Original Poster
Rep: Reputation: 20
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
Registered: Dec 2008
Location: Cape Town, South Africa
Distribution: Slackware 14.2 64 Multi-Lib
Posts: 491

Rep: Reputation: 168Reputation: 168
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
Registered: Apr 2004
Posts: 113

Original Poster
Rep: Reputation: 20

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
Senior Member
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 4,313

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


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 07:00 AM.

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