Modify fstab file on servers [closed]
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
Platform: Linux
Bash shell
Need help in modify only 2nd column i.e mount points of NAS share /vol/wrm6 in /etc/fstab file.
NAS1:/vol/wrm6 /archive/net1 NFS default 0 0
NAS2:/vol/wrm6 /archive/06 NFS default 0 0
NAS3:/vol/wrm7 /archive/07 NFS default 0 0
NAS4:/vol/wrm8 /archive/09 NFS default 0 0
The paths should be modified to have a suffix on the second column:
NAS1:/vol/wrm6 /archive/net1_05042018 NFS default 0 0
NAS2:/vol/wrm6 /archive/06_05042018 NFS default 0 0
NAS3:/vol/wrm7 /archive/07 NFS default 0 0
NAS4:/vol/wrm8 /archive/09 NFS default 0 0
requirement is whatever dir under /archive/
for NAS share /vol/wrm6 get appended _05042018
like /archive/*_05042018
. *
means may be any dir
bash text-processing fstab
closed as unclear what you're asking by Christopher, G-Man, Jeff Schaller, Timothy Martin, nwildner May 10 at 17:02
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
 |Â
show 2 more comments
up vote
0
down vote
favorite
Platform: Linux
Bash shell
Need help in modify only 2nd column i.e mount points of NAS share /vol/wrm6 in /etc/fstab file.
NAS1:/vol/wrm6 /archive/net1 NFS default 0 0
NAS2:/vol/wrm6 /archive/06 NFS default 0 0
NAS3:/vol/wrm7 /archive/07 NFS default 0 0
NAS4:/vol/wrm8 /archive/09 NFS default 0 0
The paths should be modified to have a suffix on the second column:
NAS1:/vol/wrm6 /archive/net1_05042018 NFS default 0 0
NAS2:/vol/wrm6 /archive/06_05042018 NFS default 0 0
NAS3:/vol/wrm7 /archive/07 NFS default 0 0
NAS4:/vol/wrm8 /archive/09 NFS default 0 0
requirement is whatever dir under /archive/
for NAS share /vol/wrm6 get appended _05042018
like /archive/*_05042018
. *
means may be any dir
bash text-processing fstab
closed as unclear what you're asking by Christopher, G-Man, Jeff Schaller, Timothy Martin, nwildner May 10 at 17:02
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
1
use sed
â Ipor Sircer
May 3 at 1:52
Need one line bash shell script to implement and check in one server first
â Nirmal
May 3 at 2:54
bash isn't a text editor, it's just (your default) shell that then calls commands like ssh or sed or vi...
â Jeff Schaller
May 3 at 9:53
What does it mean to "implement on one server without open fstab file"? You want to edit /etc/fstab, correct?
â Jeff Schaller
May 3 at 9:54
One line shell scripts are so boring. Just a#!
-line...
â Kusalananda
May 3 at 19:45
 |Â
show 2 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Platform: Linux
Bash shell
Need help in modify only 2nd column i.e mount points of NAS share /vol/wrm6 in /etc/fstab file.
NAS1:/vol/wrm6 /archive/net1 NFS default 0 0
NAS2:/vol/wrm6 /archive/06 NFS default 0 0
NAS3:/vol/wrm7 /archive/07 NFS default 0 0
NAS4:/vol/wrm8 /archive/09 NFS default 0 0
The paths should be modified to have a suffix on the second column:
NAS1:/vol/wrm6 /archive/net1_05042018 NFS default 0 0
NAS2:/vol/wrm6 /archive/06_05042018 NFS default 0 0
NAS3:/vol/wrm7 /archive/07 NFS default 0 0
NAS4:/vol/wrm8 /archive/09 NFS default 0 0
requirement is whatever dir under /archive/
for NAS share /vol/wrm6 get appended _05042018
like /archive/*_05042018
. *
means may be any dir
bash text-processing fstab
Platform: Linux
Bash shell
Need help in modify only 2nd column i.e mount points of NAS share /vol/wrm6 in /etc/fstab file.
NAS1:/vol/wrm6 /archive/net1 NFS default 0 0
NAS2:/vol/wrm6 /archive/06 NFS default 0 0
NAS3:/vol/wrm7 /archive/07 NFS default 0 0
NAS4:/vol/wrm8 /archive/09 NFS default 0 0
The paths should be modified to have a suffix on the second column:
NAS1:/vol/wrm6 /archive/net1_05042018 NFS default 0 0
NAS2:/vol/wrm6 /archive/06_05042018 NFS default 0 0
NAS3:/vol/wrm7 /archive/07 NFS default 0 0
NAS4:/vol/wrm8 /archive/09 NFS default 0 0
requirement is whatever dir under /archive/
for NAS share /vol/wrm6 get appended _05042018
like /archive/*_05042018
. *
means may be any dir
bash text-processing fstab
edited May 4 at 2:14
asked May 3 at 1:46
Nirmal
11
11
closed as unclear what you're asking by Christopher, G-Man, Jeff Schaller, Timothy Martin, nwildner May 10 at 17:02
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
closed as unclear what you're asking by Christopher, G-Man, Jeff Schaller, Timothy Martin, nwildner May 10 at 17:02
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
1
use sed
â Ipor Sircer
May 3 at 1:52
Need one line bash shell script to implement and check in one server first
â Nirmal
May 3 at 2:54
bash isn't a text editor, it's just (your default) shell that then calls commands like ssh or sed or vi...
â Jeff Schaller
May 3 at 9:53
What does it mean to "implement on one server without open fstab file"? You want to edit /etc/fstab, correct?
â Jeff Schaller
May 3 at 9:54
One line shell scripts are so boring. Just a#!
-line...
â Kusalananda
May 3 at 19:45
 |Â
show 2 more comments
1
use sed
â Ipor Sircer
May 3 at 1:52
Need one line bash shell script to implement and check in one server first
â Nirmal
May 3 at 2:54
bash isn't a text editor, it's just (your default) shell that then calls commands like ssh or sed or vi...
â Jeff Schaller
May 3 at 9:53
What does it mean to "implement on one server without open fstab file"? You want to edit /etc/fstab, correct?
â Jeff Schaller
May 3 at 9:54
One line shell scripts are so boring. Just a#!
-line...
â Kusalananda
May 3 at 19:45
1
1
use sed
â Ipor Sircer
May 3 at 1:52
use sed
â Ipor Sircer
May 3 at 1:52
Need one line bash shell script to implement and check in one server first
â Nirmal
May 3 at 2:54
Need one line bash shell script to implement and check in one server first
â Nirmal
May 3 at 2:54
bash isn't a text editor, it's just (your default) shell that then calls commands like ssh or sed or vi...
â Jeff Schaller
May 3 at 9:53
bash isn't a text editor, it's just (your default) shell that then calls commands like ssh or sed or vi...
â Jeff Schaller
May 3 at 9:53
What does it mean to "implement on one server without open fstab file"? You want to edit /etc/fstab, correct?
â Jeff Schaller
May 3 at 9:54
What does it mean to "implement on one server without open fstab file"? You want to edit /etc/fstab, correct?
â Jeff Schaller
May 3 at 9:54
One line shell scripts are so boring. Just a
#!
-line...â Kusalananda
May 3 at 19:45
One line shell scripts are so boring. Just a
#!
-line...â Kusalananda
May 3 at 19:45
 |Â
show 2 more comments
2 Answers
2
active
oldest
votes
up vote
1
down vote
This should take care of what you want and will add the _05042018
to all directories that fall under archive
when they involve wrm6.
sed -i -E "s/(.*wrm6[[:space:]]+/archive/)(.+)([[:space:]]+NFS.*)/12_050420183/g" /etc/fstab
Thanks, But my requirement is whatever under /archive/ will get appended _05042018 like /archive/*_05042018. * Means may be any word
â Nirmal
May 3 at 4:40
answer updated to cover any dir under archive as you have asked.
â Jeff H.
May 3 at 5:33
Jeff, there are many NAS mounts in fstab file, I want to update only for above NAS:/vol/wrm6 /archive/. I tried to grep "wrm6" /etc/fstab | sed ..that you suggested , but didn't work.
â Nirmal
May 3 at 18:20
updated answer to only address wrm6. Give it a try.
â Jeff H.
May 4 at 0:43
add a comment |Â
up vote
0
down vote
The following script would
- check that the new mount points actually exists (and abort otherwise),
- make a dated backup of the existing
/etc/fstab
file, and finally - modify the
/etc/fstab
file.
I would recommend to run it on a copy of the fstab
file a few times to make sure that it works on your system. Just change the fstab
variable at the top of the script to point to a different file.
The script only adds a suffix to the mount point. It doesn't try to remove it if there is already one there.
#!/bin/sh
set -e # terminate on errors (don't remove!)
fstab='/etc/fstab' # these could be made command line arguments
device_pattern='^NAS[0-9]:/vol/wrm6' # but I kept them like this for simplicity
dir_pattern='^/archive/'
suffix='_05042018'
# Check for non-existing mount points
awk -v suf="$suffix" -v dev="$device_pattern" -v dir="$dir_pattern"
'$1 ~ dev && $2 ~ dir print NR, $1, $2 suf ' "$fstab" |
while read lineno device mtpoint; do
if [ ! -d "$mtpoint" ]; then
printf 'Mount point "%s" for "%s" is missing on line %d of %sn'
"$mtpoint" "$device" "$lineno" "$fstab" >&2
#exit 1
fi
done
# Make backup
bkname="$fstab-backup.$(date +%F_%H%M%S)"
cp "$fstab" "$bkname"
# Modify file
awk -v suf="$suffix" -v dev="$device_pattern" -v dir="$dir_pattern"
'$1 ~ dev && $2 ~ dir $2 = $2 suf 1' "$bkname" >"$fstab"
echo 'Done.'
echo 'New fstab:'
cat "$fstab"
The "don't remove!" comment is for real. If set -e
is removed, then the script would not terminate if an invalid mount point is found (at least when running under bash
or pdksh
).
Just a note that while this is comprehensive, the OP was looking for a one-line script.
â Jeff H.
May 4 at 0:33
Thanks Kusalananda, your script worked in the server. I have modified my question for other server which having little bit different requirement. Can we use same script with some modifications?
â Nirmal
May 4 at 2:28
@Nirmal I've made the script more robust and able to use a pattern rather than a fixed string to pick the right first column in the file. Since this is not a script writing service and since I have no personal use for this script, I will make no further improvements to it unless it's something that interests me personally.
â Kusalananda
May 4 at 5:47
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
This should take care of what you want and will add the _05042018
to all directories that fall under archive
when they involve wrm6.
sed -i -E "s/(.*wrm6[[:space:]]+/archive/)(.+)([[:space:]]+NFS.*)/12_050420183/g" /etc/fstab
Thanks, But my requirement is whatever under /archive/ will get appended _05042018 like /archive/*_05042018. * Means may be any word
â Nirmal
May 3 at 4:40
answer updated to cover any dir under archive as you have asked.
â Jeff H.
May 3 at 5:33
Jeff, there are many NAS mounts in fstab file, I want to update only for above NAS:/vol/wrm6 /archive/. I tried to grep "wrm6" /etc/fstab | sed ..that you suggested , but didn't work.
â Nirmal
May 3 at 18:20
updated answer to only address wrm6. Give it a try.
â Jeff H.
May 4 at 0:43
add a comment |Â
up vote
1
down vote
This should take care of what you want and will add the _05042018
to all directories that fall under archive
when they involve wrm6.
sed -i -E "s/(.*wrm6[[:space:]]+/archive/)(.+)([[:space:]]+NFS.*)/12_050420183/g" /etc/fstab
Thanks, But my requirement is whatever under /archive/ will get appended _05042018 like /archive/*_05042018. * Means may be any word
â Nirmal
May 3 at 4:40
answer updated to cover any dir under archive as you have asked.
â Jeff H.
May 3 at 5:33
Jeff, there are many NAS mounts in fstab file, I want to update only for above NAS:/vol/wrm6 /archive/. I tried to grep "wrm6" /etc/fstab | sed ..that you suggested , but didn't work.
â Nirmal
May 3 at 18:20
updated answer to only address wrm6. Give it a try.
â Jeff H.
May 4 at 0:43
add a comment |Â
up vote
1
down vote
up vote
1
down vote
This should take care of what you want and will add the _05042018
to all directories that fall under archive
when they involve wrm6.
sed -i -E "s/(.*wrm6[[:space:]]+/archive/)(.+)([[:space:]]+NFS.*)/12_050420183/g" /etc/fstab
This should take care of what you want and will add the _05042018
to all directories that fall under archive
when they involve wrm6.
sed -i -E "s/(.*wrm6[[:space:]]+/archive/)(.+)([[:space:]]+NFS.*)/12_050420183/g" /etc/fstab
edited May 4 at 0:43
answered May 3 at 4:27
Jeff H.
1667
1667
Thanks, But my requirement is whatever under /archive/ will get appended _05042018 like /archive/*_05042018. * Means may be any word
â Nirmal
May 3 at 4:40
answer updated to cover any dir under archive as you have asked.
â Jeff H.
May 3 at 5:33
Jeff, there are many NAS mounts in fstab file, I want to update only for above NAS:/vol/wrm6 /archive/. I tried to grep "wrm6" /etc/fstab | sed ..that you suggested , but didn't work.
â Nirmal
May 3 at 18:20
updated answer to only address wrm6. Give it a try.
â Jeff H.
May 4 at 0:43
add a comment |Â
Thanks, But my requirement is whatever under /archive/ will get appended _05042018 like /archive/*_05042018. * Means may be any word
â Nirmal
May 3 at 4:40
answer updated to cover any dir under archive as you have asked.
â Jeff H.
May 3 at 5:33
Jeff, there are many NAS mounts in fstab file, I want to update only for above NAS:/vol/wrm6 /archive/. I tried to grep "wrm6" /etc/fstab | sed ..that you suggested , but didn't work.
â Nirmal
May 3 at 18:20
updated answer to only address wrm6. Give it a try.
â Jeff H.
May 4 at 0:43
Thanks, But my requirement is whatever under /archive/ will get appended _05042018 like /archive/*_05042018. * Means may be any word
â Nirmal
May 3 at 4:40
Thanks, But my requirement is whatever under /archive/ will get appended _05042018 like /archive/*_05042018. * Means may be any word
â Nirmal
May 3 at 4:40
answer updated to cover any dir under archive as you have asked.
â Jeff H.
May 3 at 5:33
answer updated to cover any dir under archive as you have asked.
â Jeff H.
May 3 at 5:33
Jeff, there are many NAS mounts in fstab file, I want to update only for above NAS:/vol/wrm6 /archive/. I tried to grep "wrm6" /etc/fstab | sed ..that you suggested , but didn't work.
â Nirmal
May 3 at 18:20
Jeff, there are many NAS mounts in fstab file, I want to update only for above NAS:/vol/wrm6 /archive/. I tried to grep "wrm6" /etc/fstab | sed ..that you suggested , but didn't work.
â Nirmal
May 3 at 18:20
updated answer to only address wrm6. Give it a try.
â Jeff H.
May 4 at 0:43
updated answer to only address wrm6. Give it a try.
â Jeff H.
May 4 at 0:43
add a comment |Â
up vote
0
down vote
The following script would
- check that the new mount points actually exists (and abort otherwise),
- make a dated backup of the existing
/etc/fstab
file, and finally - modify the
/etc/fstab
file.
I would recommend to run it on a copy of the fstab
file a few times to make sure that it works on your system. Just change the fstab
variable at the top of the script to point to a different file.
The script only adds a suffix to the mount point. It doesn't try to remove it if there is already one there.
#!/bin/sh
set -e # terminate on errors (don't remove!)
fstab='/etc/fstab' # these could be made command line arguments
device_pattern='^NAS[0-9]:/vol/wrm6' # but I kept them like this for simplicity
dir_pattern='^/archive/'
suffix='_05042018'
# Check for non-existing mount points
awk -v suf="$suffix" -v dev="$device_pattern" -v dir="$dir_pattern"
'$1 ~ dev && $2 ~ dir print NR, $1, $2 suf ' "$fstab" |
while read lineno device mtpoint; do
if [ ! -d "$mtpoint" ]; then
printf 'Mount point "%s" for "%s" is missing on line %d of %sn'
"$mtpoint" "$device" "$lineno" "$fstab" >&2
#exit 1
fi
done
# Make backup
bkname="$fstab-backup.$(date +%F_%H%M%S)"
cp "$fstab" "$bkname"
# Modify file
awk -v suf="$suffix" -v dev="$device_pattern" -v dir="$dir_pattern"
'$1 ~ dev && $2 ~ dir $2 = $2 suf 1' "$bkname" >"$fstab"
echo 'Done.'
echo 'New fstab:'
cat "$fstab"
The "don't remove!" comment is for real. If set -e
is removed, then the script would not terminate if an invalid mount point is found (at least when running under bash
or pdksh
).
Just a note that while this is comprehensive, the OP was looking for a one-line script.
â Jeff H.
May 4 at 0:33
Thanks Kusalananda, your script worked in the server. I have modified my question for other server which having little bit different requirement. Can we use same script with some modifications?
â Nirmal
May 4 at 2:28
@Nirmal I've made the script more robust and able to use a pattern rather than a fixed string to pick the right first column in the file. Since this is not a script writing service and since I have no personal use for this script, I will make no further improvements to it unless it's something that interests me personally.
â Kusalananda
May 4 at 5:47
add a comment |Â
up vote
0
down vote
The following script would
- check that the new mount points actually exists (and abort otherwise),
- make a dated backup of the existing
/etc/fstab
file, and finally - modify the
/etc/fstab
file.
I would recommend to run it on a copy of the fstab
file a few times to make sure that it works on your system. Just change the fstab
variable at the top of the script to point to a different file.
The script only adds a suffix to the mount point. It doesn't try to remove it if there is already one there.
#!/bin/sh
set -e # terminate on errors (don't remove!)
fstab='/etc/fstab' # these could be made command line arguments
device_pattern='^NAS[0-9]:/vol/wrm6' # but I kept them like this for simplicity
dir_pattern='^/archive/'
suffix='_05042018'
# Check for non-existing mount points
awk -v suf="$suffix" -v dev="$device_pattern" -v dir="$dir_pattern"
'$1 ~ dev && $2 ~ dir print NR, $1, $2 suf ' "$fstab" |
while read lineno device mtpoint; do
if [ ! -d "$mtpoint" ]; then
printf 'Mount point "%s" for "%s" is missing on line %d of %sn'
"$mtpoint" "$device" "$lineno" "$fstab" >&2
#exit 1
fi
done
# Make backup
bkname="$fstab-backup.$(date +%F_%H%M%S)"
cp "$fstab" "$bkname"
# Modify file
awk -v suf="$suffix" -v dev="$device_pattern" -v dir="$dir_pattern"
'$1 ~ dev && $2 ~ dir $2 = $2 suf 1' "$bkname" >"$fstab"
echo 'Done.'
echo 'New fstab:'
cat "$fstab"
The "don't remove!" comment is for real. If set -e
is removed, then the script would not terminate if an invalid mount point is found (at least when running under bash
or pdksh
).
Just a note that while this is comprehensive, the OP was looking for a one-line script.
â Jeff H.
May 4 at 0:33
Thanks Kusalananda, your script worked in the server. I have modified my question for other server which having little bit different requirement. Can we use same script with some modifications?
â Nirmal
May 4 at 2:28
@Nirmal I've made the script more robust and able to use a pattern rather than a fixed string to pick the right first column in the file. Since this is not a script writing service and since I have no personal use for this script, I will make no further improvements to it unless it's something that interests me personally.
â Kusalananda
May 4 at 5:47
add a comment |Â
up vote
0
down vote
up vote
0
down vote
The following script would
- check that the new mount points actually exists (and abort otherwise),
- make a dated backup of the existing
/etc/fstab
file, and finally - modify the
/etc/fstab
file.
I would recommend to run it on a copy of the fstab
file a few times to make sure that it works on your system. Just change the fstab
variable at the top of the script to point to a different file.
The script only adds a suffix to the mount point. It doesn't try to remove it if there is already one there.
#!/bin/sh
set -e # terminate on errors (don't remove!)
fstab='/etc/fstab' # these could be made command line arguments
device_pattern='^NAS[0-9]:/vol/wrm6' # but I kept them like this for simplicity
dir_pattern='^/archive/'
suffix='_05042018'
# Check for non-existing mount points
awk -v suf="$suffix" -v dev="$device_pattern" -v dir="$dir_pattern"
'$1 ~ dev && $2 ~ dir print NR, $1, $2 suf ' "$fstab" |
while read lineno device mtpoint; do
if [ ! -d "$mtpoint" ]; then
printf 'Mount point "%s" for "%s" is missing on line %d of %sn'
"$mtpoint" "$device" "$lineno" "$fstab" >&2
#exit 1
fi
done
# Make backup
bkname="$fstab-backup.$(date +%F_%H%M%S)"
cp "$fstab" "$bkname"
# Modify file
awk -v suf="$suffix" -v dev="$device_pattern" -v dir="$dir_pattern"
'$1 ~ dev && $2 ~ dir $2 = $2 suf 1' "$bkname" >"$fstab"
echo 'Done.'
echo 'New fstab:'
cat "$fstab"
The "don't remove!" comment is for real. If set -e
is removed, then the script would not terminate if an invalid mount point is found (at least when running under bash
or pdksh
).
The following script would
- check that the new mount points actually exists (and abort otherwise),
- make a dated backup of the existing
/etc/fstab
file, and finally - modify the
/etc/fstab
file.
I would recommend to run it on a copy of the fstab
file a few times to make sure that it works on your system. Just change the fstab
variable at the top of the script to point to a different file.
The script only adds a suffix to the mount point. It doesn't try to remove it if there is already one there.
#!/bin/sh
set -e # terminate on errors (don't remove!)
fstab='/etc/fstab' # these could be made command line arguments
device_pattern='^NAS[0-9]:/vol/wrm6' # but I kept them like this for simplicity
dir_pattern='^/archive/'
suffix='_05042018'
# Check for non-existing mount points
awk -v suf="$suffix" -v dev="$device_pattern" -v dir="$dir_pattern"
'$1 ~ dev && $2 ~ dir print NR, $1, $2 suf ' "$fstab" |
while read lineno device mtpoint; do
if [ ! -d "$mtpoint" ]; then
printf 'Mount point "%s" for "%s" is missing on line %d of %sn'
"$mtpoint" "$device" "$lineno" "$fstab" >&2
#exit 1
fi
done
# Make backup
bkname="$fstab-backup.$(date +%F_%H%M%S)"
cp "$fstab" "$bkname"
# Modify file
awk -v suf="$suffix" -v dev="$device_pattern" -v dir="$dir_pattern"
'$1 ~ dev && $2 ~ dir $2 = $2 suf 1' "$bkname" >"$fstab"
echo 'Done.'
echo 'New fstab:'
cat "$fstab"
The "don't remove!" comment is for real. If set -e
is removed, then the script would not terminate if an invalid mount point is found (at least when running under bash
or pdksh
).
edited May 4 at 5:42
answered May 3 at 20:19
Kusalananda
102k13199316
102k13199316
Just a note that while this is comprehensive, the OP was looking for a one-line script.
â Jeff H.
May 4 at 0:33
Thanks Kusalananda, your script worked in the server. I have modified my question for other server which having little bit different requirement. Can we use same script with some modifications?
â Nirmal
May 4 at 2:28
@Nirmal I've made the script more robust and able to use a pattern rather than a fixed string to pick the right first column in the file. Since this is not a script writing service and since I have no personal use for this script, I will make no further improvements to it unless it's something that interests me personally.
â Kusalananda
May 4 at 5:47
add a comment |Â
Just a note that while this is comprehensive, the OP was looking for a one-line script.
â Jeff H.
May 4 at 0:33
Thanks Kusalananda, your script worked in the server. I have modified my question for other server which having little bit different requirement. Can we use same script with some modifications?
â Nirmal
May 4 at 2:28
@Nirmal I've made the script more robust and able to use a pattern rather than a fixed string to pick the right first column in the file. Since this is not a script writing service and since I have no personal use for this script, I will make no further improvements to it unless it's something that interests me personally.
â Kusalananda
May 4 at 5:47
Just a note that while this is comprehensive, the OP was looking for a one-line script.
â Jeff H.
May 4 at 0:33
Just a note that while this is comprehensive, the OP was looking for a one-line script.
â Jeff H.
May 4 at 0:33
Thanks Kusalananda, your script worked in the server. I have modified my question for other server which having little bit different requirement. Can we use same script with some modifications?
â Nirmal
May 4 at 2:28
Thanks Kusalananda, your script worked in the server. I have modified my question for other server which having little bit different requirement. Can we use same script with some modifications?
â Nirmal
May 4 at 2:28
@Nirmal I've made the script more robust and able to use a pattern rather than a fixed string to pick the right first column in the file. Since this is not a script writing service and since I have no personal use for this script, I will make no further improvements to it unless it's something that interests me personally.
â Kusalananda
May 4 at 5:47
@Nirmal I've made the script more robust and able to use a pattern rather than a fixed string to pick the right first column in the file. Since this is not a script writing service and since I have no personal use for this script, I will make no further improvements to it unless it's something that interests me personally.
â Kusalananda
May 4 at 5:47
add a comment |Â
1
use sed
â Ipor Sircer
May 3 at 1:52
Need one line bash shell script to implement and check in one server first
â Nirmal
May 3 at 2:54
bash isn't a text editor, it's just (your default) shell that then calls commands like ssh or sed or vi...
â Jeff Schaller
May 3 at 9:53
What does it mean to "implement on one server without open fstab file"? You want to edit /etc/fstab, correct?
â Jeff Schaller
May 3 at 9:54
One line shell scripts are so boring. Just a
#!
-line...â Kusalananda
May 3 at 19:45