Open a file in UNIX mode


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Open a file in UNIX mode
# 8  
Old 05-07-2013
Hi,

Try doing unix2dos

Eg : unix2dos file_name (in server itself before getting the file in local system)
# 9  
Old 05-07-2013
can anyone please help me out with the block of script for the problem being discussed.


Thanks.
# 10  
Old 05-07-2013
So you are using Activestate Perl on a Windows box and want a file that will transfer to a *nix box with a *nix type of End of Line character?

Try this, I've heard it should work, but haven't tested it yet.

Code:
open(OUTPUT, ">$output_filename");  #opens the file in (DOS) windows mode
binmode OUTPUT;

Then make sure your print lines use "\n", when writing to OUTPUT. It should translate it to "LF" only, not "CRLF" as Windows likes.
# 11  
Old 05-07-2013
Use the command strings to remove ^M character

Code:
# strings file_with_control_m > file_without_contol_m

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cannot open txt file in UNIX using cat utility

Hi, I am not being able to open txt files with 'cat'. One thing to mention is, the filenames start with #. I guess one can have a unix filename that starts with a special/wildcard character. I have filenames starting with @ and they are opening perfectly with cat. (5 Replies)
Discussion started by: Subhasis
5 Replies

2. UNIX for Dummies Questions & Answers

File processed in Unix had issue open using notepad

Dear all, I had a columned based file after processed from my script. In unix platform, my file is ok, with all columns sorted out nicely. But when i open in windows notepad, the columns are running out of order. Can some one help?? Thanks alot in advance (4 Replies)
Discussion started by: ymeyaw
4 Replies

3. Shell Programming and Scripting

how to open a file and read a file in UNIX

HI can any one tell me how to open and read a file in UNIX actually i have the following script can you please suggest me on this.. LOG,">$log" or NotifyAdmin "Failed to open file $log";... this is the perl statement.. which opens log file. i want to open same log file in unix Thanks... (5 Replies)
Discussion started by: sravan008
5 Replies

4. Solaris

Before I delete any file in Unix, How can I check no open file handle is pointing to that file?

I know how to check if any file has a unix process using a file by looking at 'lsof <fullpath/filename>' command. I think using lsof is very expensive. Also to make it accurate we need to inlcude fullpath of the file. Is there another command that can tell if a file has a truely active... (12 Replies)
Discussion started by: kchinnam
12 Replies

5. UNIX for Dummies Questions & Answers

open windows's .url file in unix

In windows, I can create a shortcut for websites. It's a .url file. the content of the file is like: How can I open it, the .url file, in firefox or google chrome in Unix(or just ubuntu)? (2 Replies)
Discussion started by: hz_i3
2 Replies

6. Shell Programming and Scripting

how to identify the mode of the file in unix

hi, I have a requirement in that i need to process a input file The problem is, the input file sometimes it is coming in dos mode and some times it is coming in unix mode The script which i have written will process the file only if it is in unix mode and it is not processing if the file is in... (7 Replies)
Discussion started by: trichyselva
7 Replies

7. UNIX for Dummies Questions & Answers

Open .zip file created in UNIX

Hi I am using the unix zip command to zip a file name to name .zip. I am then ftping the file to my windows Xp desktop and trying to open it using compressed(zipped) folders. Then iam getting an error like 'the compressed(zipped) folder is invalid or corrupted' Please advice. regards,... (5 Replies)
Discussion started by: sam99
5 Replies

8. Shell Programming and Scripting

open unix file in windows

Hi, I have a text file in unix. i am trying to give a link in Internet explorer to that file. If i click on the link in Internet Explorer page then it should display the text from file in unix. is that anyway possible.... i am trying it for past 2 days....if i find a way out i will... (3 Replies)
Discussion started by: ganesh
3 Replies

9. UNIX for Dummies Questions & Answers

How do u open a read only file in Unix?

How do u open a read only file in Unix? (1 Reply)
Discussion started by: JosephGerard
1 Replies

10. UNIX for Dummies Questions & Answers

open a picture file in unix (putty)

hi i'm logged on to my schools unix machine via putty. how do i open/view a jpg picture file that is there on my root catalog? (2 Replies)
Discussion started by: javatutor
2 Replies
Login or Register to Ask a Question