By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,835 Members | 2,305 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,835 IT Pros & Developers. It's quick & easy.

inserting a line before a certain text in multiple files in a folder

P: 2
Hi all,

I have a folder named "folder" having multiple files inside different nested folders.
Many files under it have a certain text that i am looking for. Before this line, I have to add a line and save it.

The certain text is something like:
return xyz;

If its this I want to add a line just before return xyz;

if the certain text (return xyz) is present but no ( } ), then I want to add
certain text(return xyz;)

.... The file in which i find such text, i to add a nth line.

Sep 18 '08 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 410
Let us know what you have tried so far.
To parse through hierarchial directory structure (multiple sub-folders), you can make use of File::Find module.
Sep 18 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.