LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Copy text files from linux to windows (http://www.linuxquestions.org/questions/linux-newbie-8/copy-text-files-from-linux-to-windows-812730/)

Idiosyncra3y 06-07-2010 03:32 PM

Copy text files from linux to windows
 
Hi

I am running some Pcap files through editcap and then tshark. I am running fedora 11. This will create a couple of thousand text files all numbered sequencially 1-x. How can I copy these files across a network(I connect using putty) or how can I copy them onto an external HD so that when I view them on the windows machine they have the right formatting (Windows know to open them with wordpad/notepad) basically that windows knows that they are text?
edit: The linux machine has ext 4 HD's, the windows has NTFS. Would it help if I used an external HD with fat32?
Thanks a lot

MensaWater 06-07-2010 03:48 PM

UNIX/Linux use only Line Feed (LF) at end of a line where as Windows/DOS uses LF/CR (Carriage Return). That is a control-M. When you copy DOS text file to UNIX/Linux and vi it you actually see the ^M at the end of each line.

You can convert Linux text to DOS text by running "unix2dos" on the file. You can convert DOS text to Linux text by running "dos2unix".

If you use ftp for the transfer and do it in ASCII mode rather than BINARY mode it actually does the conversion for you. (In BINARY mode it transfers the files "as is").

smoker 06-07-2010 03:55 PM

Set your program to create the files with a .txt extension. That takes care of one problem.
It doesn't matter about the different filesystems if you copy across a network. That's the whole point of protocols - any machine can understand them.

I would suggest using the built-in windows ftp client to log into the linux machine and use mget *.txt to retrieve the files. Change to the correct local directory before starting the ftp client.

This of course assumes you have ftp installed and running on fedora. If not then yum install vsftpd and open the port in the firewall.

smoker 06-07-2010 03:59 PM

Quote:

If you use ftp for the transfer and do it in ASCII mode rather than BINARY mode it actually does the conversion for you.
No it doesn't.

jstephens84 06-07-2010 05:05 PM

I didn't see anyone recommend winscp. SCP uses ssh to copy files over and is graphical.

You can also create a share one your xp workstation and connect to it using samba.

As for the formatting I don't think I have ever had a problem going from unix formatted files to windows. Only had problems going in reverse because of windows new line formatting.

Idiosyncra3y 06-08-2010 04:03 AM

Thank you all... A fool I am. The simplest solution is so often the best: Include the .txt extension when I print the files. Didn't know that linux would accept that. Thanks all

alli_yas 06-08-2010 05:40 AM

Quote:

I didn't see anyone recommend winscp. SCP uses ssh to copy files over and is graphical.
Was just about too :) WinSCP is a great tool for doing this kind of thing where you're moving files across between Linux/Windows.

posixculprit 06-08-2010 07:06 AM

Quote:

Originally Posted by smoker (Post 3995792)
No it doesn't.

Yes it does. RFC 959 "File Transfer Protocol", section 3.1.1.1:

Quote:

3.1.1.1. ASCII TYPE

This is the default type and must be accepted by all FTP
implementations. It is intended primarily for the transfer
of text files, except when both hosts would find the EBCDIC
type more convenient.

The sender converts the data from an internal character
representation to the standard 8-bit NVT-ASCII
representation (see the Telnet specification). The receiver
will convert the data from the standard form to his own
internal form.

In accordance with the NVT standard, the <CRLF> sequence
should be used where necessary to denote the end of a line
of text.
TFTP (Trivial File Transfer Protocol) also has such an "ASCII" mode.

MensaWater 06-08-2010 10:28 AM

Quote:

I've been doing this for over a decade. If you don't like my response, ask yourself why I gave it.
I am never difficult just for the sake of it. (unless you insult me)
I do NOT like your response and think you WERE just being difficult because:
1) It is wrong
2) You didn't offer any alternative assistance to the OP.
3) Your signature shows you think you know it all.

I've been doing UNIX full time since 1991 and Linux since 1997 and I'm smart enough to know that I don't know it all yet and likely never will. I'm also fairly certain you do not and never will either.

Tinkster 06-08-2010 12:57 PM

Quote:

Originally Posted by MensaWater (Post 3996737)
I do NOT like your response and think you WERE just being difficult because:
1) It is wrong
2) You didn't offer any alternative assistance to the OP.
3) Your signature shows you think you know it all.

I've been doing UNIX full time since 1991 and Linux since 1997 and I'm smart enough to know that I don't know it all yet and likely never will. I'm also fairly certain you do not and never will either.


And your sig gives you the right to knock others
sig in public rather than in an e-Mail? I think not.


Cheers,
Tink

smoker 06-08-2010 01:02 PM

Quote:

Originally Posted by MensaWater (Post 3996737)
I do NOT like your response and think you WERE just being difficult because:
1) It is wrong
2) You didn't offer any alternative assistance to the OP.
3) Your signature shows you think you know it all.

I've been doing UNIX full time since 1991 and Linux since 1997 and I'm smart enough to know that I don't know it all yet and likely never will. I'm also fairly certain you do not and never will either.

Did you read my other response ?

FTP does not convert *nix format to windows format.

It's because of people like you that I have such a signature.

I never make a post without testing it first.
So, go on, vi a document in linux, save it with a .txt extension then ftp get it from a windows machine. Make sure to open it with Notepad.

It has never worked for me on many versions of linux since the late '90s.

So you are now on my ignore list. Happy now ?

Maybe you should try to understand the statements I make in my sig.
They came about because of fools who DID think they knew it all and refused to take advice. At no stage do I claim to "know it all" I merely suggest that my answers may contain the idea that the person needs to use TO WORK IT OUT FOR THEMSELVES instead of expecting a word perfect solution to every little problem they have.

Tinkster 06-08-2010 01:42 PM

And since this is derailing I'm closing it. My apologies to the OP.


All times are GMT -5. The time now is 07:59 PM.