469,330 Members | 1,286 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,330 developers. It's quick & easy.

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

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;
printf("xyz");

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


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

thanks.
Sep 18 '08 #1
1 1244
nithinpes
410 Expert 256MB
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.

Similar topics

2 posts views Thread by Jaunty Edward | last post: by
reply views Thread by GreenFROG Design | last post: by
5 posts views Thread by gwarning! | last post: by
6 posts views Thread by tomtown.net | last post: by
4 posts views Thread by Zenon | last post: by
10 posts views Thread by kimiraikkonen | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Purva khokhar | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.