Script for update
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I have a script used for update :
OLD="int 10"
NEW="int 20"
i=0
DPATH="/home"
for f in $DPATH
do
sed -i "s/$OLD/$NEW/g" $f
let i++
echo "modified:" $f
done
what i need according to my old value have the path where i can change OLD to NEW (for update)
linux bash scripting grep updatedb
add a comment |
up vote
0
down vote
favorite
I have a script used for update :
OLD="int 10"
NEW="int 20"
i=0
DPATH="/home"
for f in $DPATH
do
sed -i "s/$OLD/$NEW/g" $f
let i++
echo "modified:" $f
done
what i need according to my old value have the path where i can change OLD to NEW (for update)
linux bash scripting grep updatedb
Would you like to rename the files inDPATH
or modify the contents of certain files inDPATH
. Some examples would help.
– rahul
Apr 29 '15 at 14:57
i want to modify the contents of txt file in DPATH my value OLD is in many txt file in DPATH so i want to have this path to do the update .Thanks for your help
– toto
Apr 29 '15 at 15:02
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a script used for update :
OLD="int 10"
NEW="int 20"
i=0
DPATH="/home"
for f in $DPATH
do
sed -i "s/$OLD/$NEW/g" $f
let i++
echo "modified:" $f
done
what i need according to my old value have the path where i can change OLD to NEW (for update)
linux bash scripting grep updatedb
I have a script used for update :
OLD="int 10"
NEW="int 20"
i=0
DPATH="/home"
for f in $DPATH
do
sed -i "s/$OLD/$NEW/g" $f
let i++
echo "modified:" $f
done
what i need according to my old value have the path where i can change OLD to NEW (for update)
linux bash scripting grep updatedb
linux bash scripting grep updatedb
edited Nov 18 at 9:26
Rui F Ribeiro
38.2k1475123
38.2k1475123
asked Apr 29 '15 at 14:54
toto
59138
59138
Would you like to rename the files inDPATH
or modify the contents of certain files inDPATH
. Some examples would help.
– rahul
Apr 29 '15 at 14:57
i want to modify the contents of txt file in DPATH my value OLD is in many txt file in DPATH so i want to have this path to do the update .Thanks for your help
– toto
Apr 29 '15 at 15:02
add a comment |
Would you like to rename the files inDPATH
or modify the contents of certain files inDPATH
. Some examples would help.
– rahul
Apr 29 '15 at 14:57
i want to modify the contents of txt file in DPATH my value OLD is in many txt file in DPATH so i want to have this path to do the update .Thanks for your help
– toto
Apr 29 '15 at 15:02
Would you like to rename the files in
DPATH
or modify the contents of certain files in DPATH
. Some examples would help.– rahul
Apr 29 '15 at 14:57
Would you like to rename the files in
DPATH
or modify the contents of certain files in DPATH
. Some examples would help.– rahul
Apr 29 '15 at 14:57
i want to modify the contents of txt file in DPATH my value OLD is in many txt file in DPATH so i want to have this path to do the update .Thanks for your help
– toto
Apr 29 '15 at 15:02
i want to modify the contents of txt file in DPATH my value OLD is in many txt file in DPATH so i want to have this path to do the update .Thanks for your help
– toto
Apr 29 '15 at 15:02
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
You can use this script:
#!/bin/bash
OLD="int 10"
NEW="int 20"
for file in /home/a/*; do
[[ -f $file ]] && sed -i "s/$OLD/$NEW/g" "$file" && echo "modified: $file"
done
i have this error sed: couldn't edit /home/a/b: not a regular file I think the problem that they can't have the subdirectory
– toto
Apr 29 '15 at 15:33
@toto: Check my edits..you were getting the eroor because/home/a/b
is a direcotiry..now we are considering regular files only..
– heemayl
Apr 29 '15 at 15:37
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You can use this script:
#!/bin/bash
OLD="int 10"
NEW="int 20"
for file in /home/a/*; do
[[ -f $file ]] && sed -i "s/$OLD/$NEW/g" "$file" && echo "modified: $file"
done
i have this error sed: couldn't edit /home/a/b: not a regular file I think the problem that they can't have the subdirectory
– toto
Apr 29 '15 at 15:33
@toto: Check my edits..you were getting the eroor because/home/a/b
is a direcotiry..now we are considering regular files only..
– heemayl
Apr 29 '15 at 15:37
add a comment |
up vote
0
down vote
You can use this script:
#!/bin/bash
OLD="int 10"
NEW="int 20"
for file in /home/a/*; do
[[ -f $file ]] && sed -i "s/$OLD/$NEW/g" "$file" && echo "modified: $file"
done
i have this error sed: couldn't edit /home/a/b: not a regular file I think the problem that they can't have the subdirectory
– toto
Apr 29 '15 at 15:33
@toto: Check my edits..you were getting the eroor because/home/a/b
is a direcotiry..now we are considering regular files only..
– heemayl
Apr 29 '15 at 15:37
add a comment |
up vote
0
down vote
up vote
0
down vote
You can use this script:
#!/bin/bash
OLD="int 10"
NEW="int 20"
for file in /home/a/*; do
[[ -f $file ]] && sed -i "s/$OLD/$NEW/g" "$file" && echo "modified: $file"
done
You can use this script:
#!/bin/bash
OLD="int 10"
NEW="int 20"
for file in /home/a/*; do
[[ -f $file ]] && sed -i "s/$OLD/$NEW/g" "$file" && echo "modified: $file"
done
edited Apr 29 '15 at 15:36
answered Apr 29 '15 at 15:13
heemayl
34k370100
34k370100
i have this error sed: couldn't edit /home/a/b: not a regular file I think the problem that they can't have the subdirectory
– toto
Apr 29 '15 at 15:33
@toto: Check my edits..you were getting the eroor because/home/a/b
is a direcotiry..now we are considering regular files only..
– heemayl
Apr 29 '15 at 15:37
add a comment |
i have this error sed: couldn't edit /home/a/b: not a regular file I think the problem that they can't have the subdirectory
– toto
Apr 29 '15 at 15:33
@toto: Check my edits..you were getting the eroor because/home/a/b
is a direcotiry..now we are considering regular files only..
– heemayl
Apr 29 '15 at 15:37
i have this error sed: couldn't edit /home/a/b: not a regular file I think the problem that they can't have the subdirectory
– toto
Apr 29 '15 at 15:33
i have this error sed: couldn't edit /home/a/b: not a regular file I think the problem that they can't have the subdirectory
– toto
Apr 29 '15 at 15:33
@toto: Check my edits..you were getting the eroor because
/home/a/b
is a direcotiry..now we are considering regular files only..– heemayl
Apr 29 '15 at 15:37
@toto: Check my edits..you were getting the eroor because
/home/a/b
is a direcotiry..now we are considering regular files only..– heemayl
Apr 29 '15 at 15:37
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f199424%2fscript-for-update%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Would you like to rename the files in
DPATH
or modify the contents of certain files inDPATH
. Some examples would help.– rahul
Apr 29 '15 at 14:57
i want to modify the contents of txt file in DPATH my value OLD is in many txt file in DPATH so i want to have this path to do the update .Thanks for your help
– toto
Apr 29 '15 at 15:02