LinuxQuestions.org
Help answer threads with 0 replies.
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, 06:43 AM   #1
pr0xibus
Member
 
Registered: Apr 2004
Location: Scotland
Distribution: Slackware
Posts: 218

Rep: Reputation: 44
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, 06:48 AM   #2
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8119Reputation: 8119Reputation: 8119Reputation: 8119Reputation: 8119Reputation: 8119Reputation: 8119Reputation: 8119Reputation: 8119Reputation: 8119Reputation: 8119
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, 07:10 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,514

Rep: Reputation: 6224Reputation: 6224Reputation: 6224Reputation: 6224Reputation: 6224Reputation: 6224Reputation: 6224Reputation: 6224Reputation: 6224Reputation: 6224Reputation: 6224
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, 07:13 AM   #4
pr0xibus
Member
 
Registered: Apr 2004
Location: Scotland
Distribution: Slackware
Posts: 218

Original Poster
Rep: Reputation: 44
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, 07:35 AM   #5
Mark Pettit
Member
 
Registered: Dec 2008
Location: Cape Town, South Africa
Distribution: Slackware 15.0
Posts: 647

Rep: Reputation: 307Reputation: 307Reputation: 307Reputation: 307
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, 07:40 AM   #6
pr0xibus
Member
 
Registered: Apr 2004
Location: Scotland
Distribution: Slackware
Posts: 218

Original Poster
Rep: Reputation: 44
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 07:47 AM.
 
Old 04-04-2014, 07:58 AM   #7
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,525

Rep: Reputation: 2812Reputation: 2812Reputation: 2812Reputation: 2812Reputation: 2812Reputation: 2812Reputation: 2812Reputation: 2812Reputation: 2812Reputation: 2812Reputation: 2812
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 11:31 AM
[SOLVED] bash suggestions to convert horizontal columns to vertical columns Guyverix Programming 14 01-24-2013 12:03 PM
SQL statements howto -- 3 columns input but 2 columns output fhleung Programming 3 11-29-2012 11:45 AM
Map 1 CSV's columns to matching columns in another CSV 2legit2quit Programming 7 10-27-2011 09:53 AM
[SOLVED] AWK: add columns while keep format for other columns cristalp Programming 3 10-13-2011 07:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:16 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
Open Source Consulting | Domain Registration