LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-05-2004, 10:51 AM   #1
figgypower
LQ Newbie
 
Registered: Jul 2003
Posts: 8

Rep: Reputation: 0
Wierd Linux text formatting


As far as I can tell, I didn't find any answer/question exactly like this one. There were some that were kinda similar, but did not answer my specific question. So, I have a text file originally made in Window's Notepad that was used under Linux (specifically, Libranet distro under KDE). I can't remember what program I used, but I thought it was a simple text editor; maybe KDE's version of Notepad?

I have already attempted to convert this text file back to Windows format. I've used unix2dos and a slew of other converters. It sort of fixes it, in that it removes the LF into Windows-readable CR. But, it still looks like gibberish:

**V*riutlaS otkcE cxahgn*e**U
esnrma/esUreI v riutkadiP
sawsro:d0 67a3
b*

It should be:

***VirtualStockExchange***
Username/UserID: virtuakid
Password: 0763ad

I know it's not smart to post account information, but that account is no longer valid (yes, I'v checked) and it never contained any sensitive information. And no, I do not use the same password for each web site/web service, or even a variation of it. I just want to know what happened, so I can decipher some of the other account information, that might still be valid. As it may already be obvious, it was an old, old password file. By the way, it still reads fine under Linux. I just want it to read fine under Windows, as well.

I appreciate any help, and I appologize if this is the wrong forum but this looked like the right forum to me.
 
Old 08-05-2004, 10:34 PM   #2
osvaldomarques
Member
 
Registered: Jul 2004
Location: Rio de Janeiro - Brazil
Distribution: Conectiva 10 - Conectiva 8 - Slackware 9 - starting with LFS
Posts: 519

Rep: Reputation: 34
Hi figgypower,
What you showed is a "word swap". All the byte pairs of your file are swapped. I wrote an script for you to swap it again. It already converts the file format to dos mode. The script is:
Code:
awk '{printf("%s\xff", $0)}' | \
sed -u 's/\(.\)\(.\)/\2\1/g' | \
awk 'BEGIN {RS = "\xff" }
{printf("%s\x0d\x0a", $0)}'
You need to copy it and paste to a file, for example, "/tmp/swap-bytes". Then, after save the file, enter "chmod +x /tmp/swap-bytes". To convert your file you have to enter
Code:
cat "Your-incomprehensible-file" | /tmp/swap-bytes >"Your-new-and-shiny-file"
Cheers.
Osvaldo.
 
  


Reply



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
How do I keep the formatting out of a text document? joshknape Linux - Software 12 09-09-2005 07:32 PM
Best language for automated text formatting darin3200 Programming 5 07-05-2004 10:18 PM
TCL/TK Formatting text liguorir Linux - Software 0 05-02-2004 09:42 AM
any good text formatting tools? santasballz Linux - Software 12 03-04-2004 08:51 PM
how to produce a text file from man w/o formatting? spyghost Linux - Newbie 2 07-30-2003 06:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:56 PM.

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