dos2unix - editing script - Help Urgent Please


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers dos2unix - editing script - Help Urgent Please
# 1  
Old 10-29-2008
Data dos2unix - editing script - Help Urgent Please

Hi this is my first time on this forum so sorry if I posted this to the wrong area.

I need help with the following. I have a basic FormMail cgi script I use. When I upload the script using filezilla, there is one line in the script that changes. The line should read &get_date; instead it reads e"t_date;

I am using putty to access the server. I see the script in the server and if I enter dos2unix and the script name I see the whole script.

How do I change the e"t_date; to get_date; using the dos2unix prompt, what is the command for that?

Anything you can do would be greatly appreciated.

Thanks
# 2  
Old 10-30-2008
dos2unix is designed for converting the Windows line terminators (carriage return and line feed) to Unix line terminators (line feed only). It doesn't (usually) make any other changes, so it won't help you here.

The simplest thing would be to hop into your favourite Unix editor and change the file manually. It's strange that &ge is changed to e" though... did you upload the file from Windows? What is the output of file filename.cgi?
# 3  
Old 11-01-2008
Are you sending the file using Filezilla in ascii or binary mode. if you send in ASCII it may be interpreting the & as a control character. If you transfer in binary then use dos2unix to convert line terminators to UNIX or any other string manipulator to remove the line windows line terminator.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

URGENT Reading a file and assessing the syntax shell script URGENT

I am trying to write a shell script which takes an input file as an arguement in the terminal e.g. bash shellscriptname.sh input.txt. I would like for the file to be read line by line each time checking if the .txt file contains certain words or letters(validating the syntax). If the line being... (1 Reply)
Discussion started by: Gurdza32
1 Replies

2. Shell Programming and Scripting

Script exits when using UNIX2dos / dos2UNIX

I'm not sure why but my script quits automatically at the point where unix2dos / dos2unix command is used. :confused::confused::confused: How do a fix it? LOG_FILE=MADDY.txt unix2dos ${LOG_FILE} exec 2> $LOG_FILE 1>&2 echo ${LOG_FILE} The script exists after the below... (3 Replies)
Discussion started by: machomaddy
3 Replies

3. Shell Programming and Scripting

[Solved] Need help in editing a script

Hi, I have one script in my cronjob, which is fetching file from a ftp site and making a copy with today's date and time. This is a new setup. There was a instance when test_bill.txt was not present on ftp.xxxx_xxxx.com and when this job ran and did not fetched file, still it send mail of... (5 Replies)
Discussion started by: solaris_1977
5 Replies

4. Shell Programming and Scripting

Issue regarding dos2unix perl script

Hi All, I have pearl script which will check and convert the file: INFO("dos2unix_cmds".$#{$dos2unix_cmds}); if ( $#{$dos2unix_cmds} == 0 ) { my $convert_cmd = $$dos2unix_cmds; my $rename_cmd = $$dos2unix_cmds; --conversion going here else INFO ("No need to... (8 Replies)
Discussion started by: saps19
8 Replies

5. Shell Programming and Scripting

editing a file in a script

Gurus, I need to write a shell script that will calculate hash value of a file, opens the file in an application for example vi editor. The application can read or modify the contents of the file. When application exists second part of my script will kick in and recalculate the hash value. File... (1 Reply)
Discussion started by: c0kazaz
1 Replies

6. UNIX for Dummies Questions & Answers

Making a script for editing

Hello all. I am trying to make a script to edit any file by replacing a string with a string. The script should be able to be applied to any given file. for instance it should be able to replace "foo" with "bar" in the file myFile.txt. I know i need to make a back up file for this to work. I just... (2 Replies)
Discussion started by: iwatk003
2 Replies

7. UNIX for Dummies Questions & Answers

Editing Shell Script

Hi I'm a newbie, but I understand that there's some space difference between unix and the pc, which is why I can't write shell script on my pc but I can view it using notepad, wordpad, etc. Is there any program I can use that will let me view the shell script and edit it without screwing up... (6 Replies)
Discussion started by: qtip
6 Replies

8. Solaris

editing files with script

hi guys, We have to implement new local (/etc/default/login) USER security policy on almost 50 stations. so editing /etc/default/login and /etc/default/passwd will be way too long work. Can we do the same using some script, I mean editing the above files and putting variables as RETRIES=3, ... (5 Replies)
Discussion started by: Asteroid
5 Replies

9. Shell Programming and Scripting

dos2unix

hi, need some urgent inputs..... I have a folder, which has both files and directories as its contents. I want to convert all the files (Excluding the directories) from dos to unix mode using the command 'dos2unix'..... please can any one help me in providing the command to convert... (3 Replies)
Discussion started by: cmaroju
3 Replies

10. Shell Programming and Scripting

calling dos2unix on shell script from within the script

I have a build script. It was created on Linux. For some reason, I got it to windows and modified it. And brought it back again to Linux. Since there is the question of the ^M chars appearing, the way out is to do a dos2unix on the script file. This is done manually. Is there a way to call... (4 Replies)
Discussion started by: vino
4 Replies
Login or Register to Ask a Question