Sponsored Content
Full Discussion: ^M in vi with php files
Top Forums UNIX for Advanced & Expert Users ^M in vi with php files Post 302529943 by cokedude on Saturday 11th of June 2011 01:25:35 PM
Old 06-11-2011
Quote:
Originally Posted by yazu
In vi you can do
Code:
:%s/<C-V><C-M>//g

where C-V and C-M are keys you should press on keyboard.
What does this do? Does C-V mean ctrl V?

Quote:
Originally Posted by Corona688
...except nobody actually has dos2unix, so sed -i 's/\r//' filename will work better (on linux. on other systems you may need to tr -d '\r' < filename > tempname ; cat tempname > filename ; rm tempname )
I don't have dos2inix but it is in my repository?

What do those sed and tr commands do? I like to learn Smilie.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

GD.dll files for php 5.1.6

Hi, I want to create an image dynamically. I used this function. $img_handle = ImageCreate ($length, 10) or die ("Cannot Create image"); It was not creating the image. When i checked in error_log file the error was: PHP Fatal error: Call to undefined function ImageCreate(). ... (0 Replies)
Discussion started by: vanitham
0 Replies

2. Shell Programming and Scripting

[php] ftp get all files from a certain file type

Hi all, I googled for this kind of function but didn't find anything. I have an FTP connection with a server, went to the dir. In this dir there are several TXT files. I would like to have function that downloads all this files, based on their .txt extension. In bash, for example, simply:... (10 Replies)
Discussion started by: laurens
10 Replies

3. Shell Programming and Scripting

PHP script to modify .forward files

Hi. I've been racking my brain on a project I've been working on for work, and hope someone here might be of assistance. Basically I'm trying to create dynamically generated .forward files for users/aliases on my email server. The intent is for these files to be generated automatically any time... (3 Replies)
Discussion started by: adotte
3 Replies

4. Web Development

php files are downloaded

Hello, I have setup Cherokee web server and php 5.2 in Opensolaris zone. Problem is that all .php files are downloaded from web server and not served when I use IP address instead of DNS name in web brovser. Example: test.mydomain.com <-- php works 192.168.0.10/index.php <--... (3 Replies)
Discussion started by: kreno
3 Replies

5. UNIX for Dummies Questions & Answers

Find php files within any matching directory name?

I am trying to search my linux box for any PHP files located within ANY directory matching a certain name. So far nothing I've tried (nor any idea I've searched for) has worked as expected. I have tried a combination of find and grep...fail. Please help? (4 Replies)
Discussion started by: macwise7
4 Replies

6. Shell Programming and Scripting

PHP Script Help - Making links to files Clickable

Ok so I wrote a php script that outputs the below to users on a webpage. # Download: /home/content/d/i/v/divine1234/eBookDownloads/ScalpRemedy_jablaa12734.zip the php code that outputs the above is: echo ("<li>Download: $download_link</li>\n"); The thing is, I dont want... (1 Reply)
Discussion started by: SkySmart
1 Replies

7. Shell Programming and Scripting

finding php, html, htm files

how can i limit the output to only php, html, htm files? i found this as one way find . -regex ".*\(php\|html\|htm\)$" -type f -print0 | xargs -0 grep 'keyword'and it works but is a bit slow is there any faster way? i tried something like this but it doesnt work: find ./ -iname "*.php"... (2 Replies)
Discussion started by: vanessafan99
2 Replies

8. Shell Programming and Scripting

Extract function names and directories from php files

I need a script that extracts function names from php files together with their location (path and file in which they are defined). The php files are located in several directories under a base directory. Ideally the output should be something like: "Path/FileName/FunctionName" for a... (2 Replies)
Discussion started by: bamse
2 Replies

9. UNIX for Dummies Questions & Answers

Deleting from .php files

Hello, I have infected .php files on my server with some code (example at the bottom,code marked red must be deleted, all .php files were infected with this same code). I was wondering how can i delete the first <?php ?> with that all code inside ?:confused: I already tried with : find . -name... (20 Replies)
Discussion started by: Corlex31
20 Replies

10. Web Development

Uploading files via php

I used the following code, which I found on the internet to upload files. <!-- The data encoding type, enctype, MUST be specified as below --> <form enctype="multipart/form-data" action="upload2.php" method="POST"> <!-- MAX_FILE_SIZE must precede the file input field --> <input... (2 Replies)
Discussion started by: jgt
2 Replies
XDIFF_FILE_DIFF(3)							 1							XDIFF_FILE_DIFF(3)

xdiff_file_diff - Make unified diff of two files

SYNOPSIS
bool xdiff_file_diff (string $old_file, string $new_file, string $dest, [int $context = 3], [bool $minimal = false]) DESCRIPTION
Makes an unified diff containing differences between $old_file and $new_file and stores it in $dest file. The resulting file is human- readable. An optional $context parameter specifies how many lines of context should be added around each change. Setting $minimal parameter to true will result in outputting the shortest patch file possible (can take a long time). PARAMETERS
o $old_file - Path to the first file. This file acts as "old" file. o $new_file - Path to the second file. This file acts as "new" file. o $dest - Path of the resulting patch file. o $context - Indicates how many lines of context you want to include in diff result. o $minimal - Set this parameter to TRUE if you want to minimalize size of the result (can take a long time). RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 xdiff_file_diff(3) example The following code makes unified diff of two php files with context length of 2. <?php $old_version = 'my_script.php'; $new_version = 'my_new_script.php'; xdiff_file_diff($old_version, $new_version, 'my_script.diff', 2); ?> NOTES
Note This function doesn't work well with binary files. To make diff of binary files use xdiff_file_bdiff(3)/xdiff_file_rabdiff(3) func- tion. SEE ALSO
xdiff_file_patch(3). PHP Documentation Group XDIFF_FILE_DIFF(3)
All times are GMT -4. The time now is 07:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy