LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Recursively Remove Comments

[ILUG] Recursively Remove Comments

Conor Mac Aoidh conormacaoidh at gmail.com
Sun Aug 15 15:42:36 IST 2010


Just noticed this morning an error with the command:

*find . -type f -name "*.php" | while read file; do sed -i -e '/*/d' $file;
done*

sed expects anything after the -i to be the extention given to all the
backup files it makes. So basically for every file that was fixed, the
original file was stored in a backup also. For example index.php would be
stored in index.php-e

With a bit of research I figured out that OS X, which I am using, doesn't
interpret the sed command the same way Linux does, and expects sed -i
commands differently, like this:

*find . -type f -name "*.php" | while read file; do sed -i "" '/*/d' $file;
done*

--
Conor

http://blog.macaoidh.name


On Sat, Aug 14, 2010 at 11:15 PM, Conor Mac Aoidh
<conormacaoidh at gmail.com>wrote:

> Hi,
>
> Thanks that did the job, just had to remove the ^ from the sed command and
> it worked perfectly.
>
> Cheers
> ---
> Conor
>
> http://conormacaoidh.com
>
>
>
> On Sat, Aug 14, 2010 at 10:52 PM, imduffy <imduffy15 at gmail.com> wrote:
>
>>  I think this should do what you want... any line starting with * will be
>> removed.
>>
>> find . -type f -name "*.php" | while read file; do sed -i -e '/^*/d'
>> $file; done
>>
>
>


More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell