I want to insert a new line of text at a certain position in certain files
recursively under a directory. More specifically, I want text like this:
include('/usr/home/www/imp-sites/default_inventory.php');
write a script:
#!/usr/local/bin/bash
(a=0
while [ $a -lt 36 ];do
read line
echo
On Friday 06 February 2009, Adam Vande More wrote:
Progress is being made as it works in the test now with the \\
however I'm running into more things I don't understand in regards to
what I need to escape in my input string.
Whether to use \ or \\ will depend on your shell. You can avoid
Wojciech Puchar wrote:
I want to insert a new line of text at a certain position in certain
files recursively under a directory. More specifically, I want text
like this:
include('/usr/home/www/imp-sites/default_inventory.php');
write a script:
#!/usr/local/bin/bash
(a=0
while [ $a -lt 36
I want to insert a new line of text at a certain position in certain
files recursively under a directory. More specifically, I want text
like this:
include('/usr/home/www/imp-sites/default_inventory.php');
to be put into file X at line 37 where file X appears in ./subdir1,
.subdir2 etc.
In the last episode (Feb 06), Adam Vande More said:
I want to insert a new line of text at a certain position in certain files
recursively under a directory. More specifically, I want text like this:
include('/usr/home/www/imp-sites/default_inventory.php');
to be put into file X at line
Dan Nelson wrote:
In the last episode (Feb 06), Adam Vande More said:
I want to insert a new line of text at a certain position in certain files
recursively under a directory. More specifically, I want text like this:
include('/usr/home/www/imp-sites/default_inventory.php');
to be put
Adam Vande More wrote:
Dan Nelson wrote:
You want:
sed -e '5i\
test' test.txt
i.e. a linebreak after the backslash.
I had actually tried that too:
sed -e '5i\
? test' text.txt
sed: 1: 5i
test
: command i expects \ followed by text
Try:
# sed -e 5i\\
? test text.txt
Note the
In the last episode (Feb 06), Adam Vande More said:
Dan Nelson wrote:
In the last episode (Feb 06), Adam Vande More said:
I want to insert a new line of text at a certain position in certain
files recursively under a directory. More specifically, I want text
like this:
Dan Nelson wrote:
I had actually tried that too:
sed -e '5i\
? test' text.txt
sed: 1: 5i
test
: command i expects \ followed by text
I don't see a backslash in the error message, which means something ate it.
Are you running this command from something other than the commandline or a
Adam Vande More wrote:
Dan Nelson wrote:
I had actually tried that too:
sed -e '5i\
? test' text.txt
sed: 1: 5i
test
: command i expects \ followed by text
I don't see a backslash in the error message, which means something
ate it. Are you running this command from something other
Adam Vande More wrote:
Dan Nelson wrote:
I had actually tried that too:
sed -e '5i\
? test' text.txt
sed: 1: 5i
test
: command i expects \ followed by text
I don't see a backslash in the error message, which means something
ate it. Are you running this command from something
Adam Vande More wrote:
I also tried escaping ( ) . / to no avail.
nevermind I see I have to \\ that as well. Okay now I'm going to try to
find a way to do this with find and xargs
IMHO, this has become a job for Perl :)
Steve
___
Just as a possible starting point...
On Fri, 06 Feb 2009 22:50:38 +, Adam Vande More amvandem...@gmail.com
wrote:
I want to insert a new line of text at a certain position in certain
files recursively under a directory. More specifically, I want text
like this:
Steve Bertrand wrote:
Adam Vande More wrote:
I also tried escaping ( ) . / to no avail.
nevermind I see I have to \\ that as well. Okay now I'm going to try to
find a way to do this with find and xargs
IMHO, this has become a job for Perl :)
Steve
Thanks for help
14 matches
Mail list logo