Sponsored Content
Top Forums Shell Programming and Scripting Need help in adding missing tag in php pages Post 302960954 by netatma on Sunday 22nd of November 2015 01:28:09 PM
Old 11-22-2015
Thanks again

there are 200+ files in each folder :-(

anything which does this in folder tree or global inside /home/user

---------- Post updated at 11:55 PM ---------- Previous update was at 11:50 PM ----------

Quote:
Originally Posted by Aia
Please, try:
Code:
perl -i -npe '$_="<?php\n$_" if $. == 1 and not /^<\?php/; $.=0 if eof' *.php

It will convert a php file content from this:
Code:
echo readfile("webdictionary.txt");
?>

to this:
Code:
<?php
echo readfile("webdictionary.txt");
?>

works like a charm Thanks SmilieSmilie
but haven't checked it thoroughly

As all the backup my friend has is also infected with malware copy, she cannot afford to loose the only working copy online.

I am going to test this for next few hours before i run it on LIVE server.

---------- Post updated at 11:58 PM ---------- Previous update was at 11:55 PM ----------

RudiC: can you please share your expertise and tell why this code didn't worked like it was supposed to be

grep -Lr --include=*.php "<?php" /home/path/ | xargs sed -i "1s/^/<?php \n/"
 

7 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Adding a CVS tag to a new file

All, I've been working with perl scripts and shell scripts for quite some time now. I've been making code changes and submitting them into cvs. But I've never created a new file and added it to the directory tree. I know the cvs commands to add it to the directory tree. What I don't know is... (1 Reply)
Discussion started by: rahulrathod
1 Replies

2. Ubuntu

useradd - shell missing features after adding user

Hi, I need to create a user from a bash script so i have to use useradd. The problem is that when i create a user with: useradd -d /home/sample -m sample after i login with that user I have no history in bash, path do not appears, i can't use arrows and so on. When I use adduser everything is... (5 Replies)
Discussion started by: ktm
5 Replies

3. Solaris

Missing man pages on SunOS Rel.5.10

Hello, last week I installed SunOS Release 5.10 on my "new" 220R. Unfortunately there seem to be no man pages, although I installed the End-User software package. Yes I know there are lots of similar topics and I hope you will help me nevertheless. Which further information do you need? ... (6 Replies)
Discussion started by: pseudocoder
6 Replies

4. UNIX for Dummies Questions & Answers

Adding missing lines in file

Dear all, I have a file with two columns - the first column is increasing every 50, the second column is just count (e.g. 5). However, when count is zero, no line is present. Sample: 1950 7 2000 14 2050 7 2100 13 2150 10 2200 9 2250 7 2300 8 2350 7... (1 Reply)
Discussion started by: TheTransporter
1 Replies

5. UNIX for Dummies Questions & Answers

Adding missing lines in file

Dear all, I have a file with two columns - the first column is increasing every 50, the second column is just count (e.g. 5). However, when count is zero, no line is present. Sample: How can I change the file so as to include lines with zero count? e.g. in the previous file to put... (4 Replies)
Discussion started by: TheTransporter
4 Replies

6. Shell Programming and Scripting

Help with missing XML tag

Hello All, I am struggling with many huge XML files with lots of Account details including at least one Membership tag, in that Membership tag one xml tag was missed that is MembershipIdentifier: (There are many Account tags with at least one Membership tag are there in each file) ...... ... (4 Replies)
Discussion started by: VasuKukkapalli
4 Replies

7. What is on Your Mind?

PHP Man Pages Now Available (Over 10,000)

Hello! Yesterday we added over 10,000 PHP man pages to our man page section. I've not yet got our unique and special recursive search feature working; but you can still access the PHP man pages directly by selecting PHP in the man sets drop down menu (left side) and then section 3 (right... (3 Replies)
Discussion started by: Neo
3 Replies
GET_INCLUDED_FILES(3)							 1						     GET_INCLUDED_FILES(3)

get_included_files - Returns an array with the names of included or required files

SYNOPSIS
array get_included_files (void ) DESCRIPTION
Gets the names of all files that have been included using include(3), include_once(3), require(3) or require_once(3). RETURN VALUES
Returns an array of the names of all files. The script originally called is considered an "included file," so it will be listed together with the files referenced by include(3) and family. Files that are included or required multiple times only show up once in the returned array. EXAMPLES
Example #1 get_included_files(3) example <?php // This file is abc.php include 'test1.php'; include_once 'test2.php'; require 'test3.php'; require_once 'test4.php'; $included_files = get_included_files(); foreach ($included_files as $filename) { echo "$filename "; } ?> The above example will output: abc.php test1.php test2.php test3.php test4.php NOTES
Note Files included using the auto_prepend_file configuration directive are not included in the returned array. SEE ALSO
include(3), include_once(3), require(3), require_once(3), get_required_files(3). PHP Documentation Group GET_INCLUDED_FILES(3)
All times are GMT -4. The time now is 09:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy