Open a file in UNIX mode


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Open a file in UNIX mode
# 1  
Old 05-06-2013
Open a file in UNIX mode

hi,

The function

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

how to open the output file in unix mode.

please suggest.

thanks.

Last edited by radoulov; 05-06-2013 at 07:21 AM..
# 2  
Old 05-06-2013
Can you be more specific? You can find more details under below link
open - perldoc.perl.org
# 3  
Old 05-06-2013
my output file is getting generated in windows(DOS) mode and contains ^M characters.

I need to open the file in unix mode so that i could invoke a command in the script itself to remove the ^M characters once the file is generated.

---------- Post updated at 06:03 PM ---------- Previous update was at 04:28 PM ----------

expecting a reply ......

Last edited by Rashid Khan; 05-06-2013 at 08:13 AM..
# 4  
Old 05-06-2013
Are you on a Windows or a Unix/Linux system?
# 5  
Old 05-06-2013
I am on windows system, however use hamilton shell to test and run the script.
# 6  
Old 05-06-2013
You mean the file you are creating itself contains the script to take care of ^M characters?
Can't you manually remove ^M by :%s/^M//g ?

Just trying to understand what you are doing...
# 7  
Old 05-06-2013
hi juzz4fun,

please go through the link

"https://www.unix.com/shell-programming-scripting/217303-regex-split-string-write-output-another-file-2.html"

I hope you will understand what the script does.

The output file generated after the script is run, contains ^M characters. And the output file is generated in Windows (Dos) mode.

I am trying to modify the script in such a way that the output file(build_dll.csh) should get opened in unix mode which will facilitate me to invoke an appropriate command in the script to remove the ^M characters from the output file.

hope the issue is clear now.
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