Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 09-18-2008, 03:59 AM   #1
Registered: May 2006
Location: Romania
Distribution: CentOS
Posts: 140

Rep: Reputation: 15
Question Batch file editing


Here's the thing, I use phpDocumentor for some of my PHP projects and it works fine. Problem is that it generates documentation files for each of the pages in my project.

When I look in the phpDocumentor generated files I can see the documentation for all my classes but the page links give me this error:

Parse error: syntax error, unexpected T_STRING in /var/www/vhosts/ on line 1
I've noticed that the first line in each of the documentation files is:

<?xml version="1.0" encoding="iso-8859-1"?>
I don't know thy is that because the files are .html so I've deleted the first line and then the error form the phpDocumentor documentation goes away.

Since I don't know any way of configuring phpDocumentor to not add the that line I'm searching for a way to remove the first line from each of the files in that directory each time the documentation is regenerated.

Problem is I'm not that good with batch editing files... any ideas ?!
Old 09-18-2008, 04:15 AM   #2
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 681Reputation: 681Reputation: 681Reputation: 681Reputation: 681Reputation: 681
The line is standard for XML files. What browser are you using?
Pages which start with that line shouldn't cause any problems. HTML was cleaned up by conforming to XML standards. The first line is a generic xml header.

You could use sed to delete the first line of files or look for that header.
sed -i '/<?xml version="1.0" encoding="iso-8859-1"?>/d' *.html
Old 09-18-2008, 04:26 AM   #3
Registered: May 2006
Location: Romania
Distribution: CentOS
Posts: 140

Original Poster
Rep: Reputation: 15
Full code in headers is this:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
  <html xmlns="">
I know the <?xml ?> is for XML files which is wierd 'cause all the files are .html

I use Chrome now but it's the same in Firefox and IE also...

[UPDATE] - Thanks dude, it works like a charm using 'sed ...'

Last edited by Braynid; 09-18-2008 at 04:32 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
batch file for accessing a shared file in ubuntu samba pdelcast Linux - Networking 5 04-24-2008 12:21 AM
batch file to convert every file in a directory with mencoder. toben Linux - Software 1 01-31-2008 05:28 PM
How to convert a batch file(.bat) to script file(.sh) manas_sem Programming 4 06-28-2007 12:10 PM
Need help with batch file Nerf Herder Linux - Newbie 6 04-22-2007 04:56 PM
batch editing multiple lines statmobile Programming 8 09-16-2004 08:05 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:53 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration