how to print the matching value from same line, which has multiple Delimiter?
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I have a File under Linux /tmp/volume.log and the content is:
[id:1091666, name:root, deviceName:/dev/sda, maxStorage:107374182400, unitNumber:0, displayOrder:0, rootVolume:true],[id:1091851, name:/var/log/devops|40GB;/home/devops|150GB, deviceName:/dev/sdb, maxStorage:289910292480, unitNumber:1, displayOrder:1, rootVolume:false]],
It will be in single line. This file is generated by some other script.
My Aim is to find the non-root volume disk and parse it to LVM Commands as Variable to extend or create new volumes, at the time of OS Build.
In the above Example.
There are two disks,
1 - sda which is root disk, (if rootVolume is true it is root disk)
2 - sdb which is non root disk (if rootVolume is false it is non root disk)
I have to grep only
rootVolume=false
and grep then
deviceName:/dev/sdb
followed by:
name:/var/log/devops|40GB;/home/devops|150GB
Once I parse all the above in to Variables, I can call those variables in the Commands like
#!/bin/bash
Disk_name=/dev/sdb
Size_Value=40G
LV_name=var_log_devops
Mount_Point=/var/log/devops
sudo pvcreate $Disk_name
sudo vgcreate vgrp01 $Disk_name
sudo lvcreate -L $Size_Value -n $var_log_devops vgrp01
sudo mkfs.xfs $var_log_devops
sudo mkdir -p $/var/log/devops
sudo mount $var_log_devops $/var/log/devops
Right now I am struck with, Extracting the Values from the Text file, becasue they are in single line and multiple Delimiters are present.
shell-script text-processing awk sed perl
add a comment |Â
up vote
1
down vote
favorite
I have a File under Linux /tmp/volume.log and the content is:
[id:1091666, name:root, deviceName:/dev/sda, maxStorage:107374182400, unitNumber:0, displayOrder:0, rootVolume:true],[id:1091851, name:/var/log/devops|40GB;/home/devops|150GB, deviceName:/dev/sdb, maxStorage:289910292480, unitNumber:1, displayOrder:1, rootVolume:false]],
It will be in single line. This file is generated by some other script.
My Aim is to find the non-root volume disk and parse it to LVM Commands as Variable to extend or create new volumes, at the time of OS Build.
In the above Example.
There are two disks,
1 - sda which is root disk, (if rootVolume is true it is root disk)
2 - sdb which is non root disk (if rootVolume is false it is non root disk)
I have to grep only
rootVolume=false
and grep then
deviceName:/dev/sdb
followed by:
name:/var/log/devops|40GB;/home/devops|150GB
Once I parse all the above in to Variables, I can call those variables in the Commands like
#!/bin/bash
Disk_name=/dev/sdb
Size_Value=40G
LV_name=var_log_devops
Mount_Point=/var/log/devops
sudo pvcreate $Disk_name
sudo vgcreate vgrp01 $Disk_name
sudo lvcreate -L $Size_Value -n $var_log_devops vgrp01
sudo mkfs.xfs $var_log_devops
sudo mkdir -p $/var/log/devops
sudo mount $var_log_devops $/var/log/devops
Right now I am struck with, Extracting the Values from the Text file, becasue they are in single line and multiple Delimiters are present.
shell-script text-processing awk sed perl
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have a File under Linux /tmp/volume.log and the content is:
[id:1091666, name:root, deviceName:/dev/sda, maxStorage:107374182400, unitNumber:0, displayOrder:0, rootVolume:true],[id:1091851, name:/var/log/devops|40GB;/home/devops|150GB, deviceName:/dev/sdb, maxStorage:289910292480, unitNumber:1, displayOrder:1, rootVolume:false]],
It will be in single line. This file is generated by some other script.
My Aim is to find the non-root volume disk and parse it to LVM Commands as Variable to extend or create new volumes, at the time of OS Build.
In the above Example.
There are two disks,
1 - sda which is root disk, (if rootVolume is true it is root disk)
2 - sdb which is non root disk (if rootVolume is false it is non root disk)
I have to grep only
rootVolume=false
and grep then
deviceName:/dev/sdb
followed by:
name:/var/log/devops|40GB;/home/devops|150GB
Once I parse all the above in to Variables, I can call those variables in the Commands like
#!/bin/bash
Disk_name=/dev/sdb
Size_Value=40G
LV_name=var_log_devops
Mount_Point=/var/log/devops
sudo pvcreate $Disk_name
sudo vgcreate vgrp01 $Disk_name
sudo lvcreate -L $Size_Value -n $var_log_devops vgrp01
sudo mkfs.xfs $var_log_devops
sudo mkdir -p $/var/log/devops
sudo mount $var_log_devops $/var/log/devops
Right now I am struck with, Extracting the Values from the Text file, becasue they are in single line and multiple Delimiters are present.
shell-script text-processing awk sed perl
I have a File under Linux /tmp/volume.log and the content is:
[id:1091666, name:root, deviceName:/dev/sda, maxStorage:107374182400, unitNumber:0, displayOrder:0, rootVolume:true],[id:1091851, name:/var/log/devops|40GB;/home/devops|150GB, deviceName:/dev/sdb, maxStorage:289910292480, unitNumber:1, displayOrder:1, rootVolume:false]],
It will be in single line. This file is generated by some other script.
My Aim is to find the non-root volume disk and parse it to LVM Commands as Variable to extend or create new volumes, at the time of OS Build.
In the above Example.
There are two disks,
1 - sda which is root disk, (if rootVolume is true it is root disk)
2 - sdb which is non root disk (if rootVolume is false it is non root disk)
I have to grep only
rootVolume=false
and grep then
deviceName:/dev/sdb
followed by:
name:/var/log/devops|40GB;/home/devops|150GB
Once I parse all the above in to Variables, I can call those variables in the Commands like
#!/bin/bash
Disk_name=/dev/sdb
Size_Value=40G
LV_name=var_log_devops
Mount_Point=/var/log/devops
sudo pvcreate $Disk_name
sudo vgcreate vgrp01 $Disk_name
sudo lvcreate -L $Size_Value -n $var_log_devops vgrp01
sudo mkfs.xfs $var_log_devops
sudo mkdir -p $/var/log/devops
sudo mount $var_log_devops $/var/log/devops
Right now I am struck with, Extracting the Values from the Text file, becasue they are in single line and multiple Delimiters are present.
shell-script text-processing awk sed perl
shell-script text-processing awk sed perl
edited Oct 1 at 11:28
Jeff Schaller
33.6k851113
33.6k851113
asked Oct 1 at 11:15
user3179298
134
134
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
0
down vote
accepted
How far would this get you:
awk -vRS="]" '/rootVolume:false/ for (i=1; i<=NF; i++) if ($i ~ /name' file
name:/var/log/devops|40GB;/home/devops|150GB,
deviceName:/dev/sdb,
It splits the single line at ]
, then scans through all fields to find the target ones, and prints them. You could read the result into shell variables like so, then:
read VARA VARB REST <<< $(awk -vRS="],*" -vORS=" " '/rootVolume:false/ for (i=1; i<=NF; i++) if ($i ~ /name' file)
echo $VARA
name:/var/log/devops|40GB;/home/devops|150GB,
echo $VARB
deviceName:/dev/sdb,
Hey, this is near perfect. How can i get only the below details ? example : #awk -vRS="]" '/rootVolume:false/ for (i=1; i<=NF; i++) if ($i ~ /name' /tmp/a | grep deviceName: deviceName:/dev/sdb, I would like to have only /dev/sdb and make that as variable.
â user3179298
Oct 1 at 12:59
Withbash
's "process substitution", you could try like. <(awk -vRS="],*" '/rootVolume:false/ deviceName/) sub (/:/, "="", $i); sub (/,$/,""", $i); print $i' file)
to define the "name" and "deviceName" variables. Watch the leading dot (for "source")!
â RudiC
Oct 1 at 13:27
add a comment |Â
up vote
4
down vote
You can use the command cut
something like:
cat /tmp/volume.log | cut -d, -f14 | tr -d "]["
rootVolume=false
make it a variable:
rootvolume=$(cat /tmp/volume.log | cut -d, -f14 | tr -d "][")
cat /tmp/volume.log | cut -d, -f3
deviceName:/dev/sda
cat /tmp/volume.log | cut -d, -f9
name:/var/log/devops|40GB;/home/devops|150GB
Or with grep
cat /tmp/volume.log | grep -o "rootVolume:false]]," | tr "][,"
make it a variable:
rootvolume=$(cat /tmp/volume.log | grep -o "rootVolume:false]]," | tr "][,")
cat /tmp/volume.log | grep -o "deviceName:/dev/sda"
cat /tmp/volume.log | grep -o "name:/var/log/devops|40GB;/home/devops|150GB" | tr -d "n"
-o, --only-matching
Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line.
Use tr
after grep
to remove , ....etc
from your output.
I gave you an example of the text file, but in real we might have more disk's. So I have to grep only the rootvolume=false and once the match is found. Then I need to get the false boot disk name. Then the other partition.
â user3179298
Oct 1 at 11:34
Hi @user3179298. You can change-f14
to match the information you want in the file. Does this make sense?
â Goro
Oct 1 at 11:35
Hello Gora, the Field will change server to server. Some times the field 14 will have root volume disk.
â user3179298
Oct 1 at 12:05
No worries, I will tweak it for you. I thought you have standard files as provided in your example!
â Goro
Oct 1 at 12:06
I have a logic, but not sure how to get that done. i see every disk are start and end with [ ..... ],[.....],[.....] So, i need to grep for root volume=false, then need to take that [......rootvolume=false ] as variable and use sed or cut to get the disk and other volume information's. then i will parse it to the script for LVM creation. But not sure how to :(
â user3179298
Oct 1 at 12:10
 |Â
show 1 more comment
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
How far would this get you:
awk -vRS="]" '/rootVolume:false/ for (i=1; i<=NF; i++) if ($i ~ /name' file
name:/var/log/devops|40GB;/home/devops|150GB,
deviceName:/dev/sdb,
It splits the single line at ]
, then scans through all fields to find the target ones, and prints them. You could read the result into shell variables like so, then:
read VARA VARB REST <<< $(awk -vRS="],*" -vORS=" " '/rootVolume:false/ for (i=1; i<=NF; i++) if ($i ~ /name' file)
echo $VARA
name:/var/log/devops|40GB;/home/devops|150GB,
echo $VARB
deviceName:/dev/sdb,
Hey, this is near perfect. How can i get only the below details ? example : #awk -vRS="]" '/rootVolume:false/ for (i=1; i<=NF; i++) if ($i ~ /name' /tmp/a | grep deviceName: deviceName:/dev/sdb, I would like to have only /dev/sdb and make that as variable.
â user3179298
Oct 1 at 12:59
Withbash
's "process substitution", you could try like. <(awk -vRS="],*" '/rootVolume:false/ deviceName/) sub (/:/, "="", $i); sub (/,$/,""", $i); print $i' file)
to define the "name" and "deviceName" variables. Watch the leading dot (for "source")!
â RudiC
Oct 1 at 13:27
add a comment |Â
up vote
0
down vote
accepted
How far would this get you:
awk -vRS="]" '/rootVolume:false/ for (i=1; i<=NF; i++) if ($i ~ /name' file
name:/var/log/devops|40GB;/home/devops|150GB,
deviceName:/dev/sdb,
It splits the single line at ]
, then scans through all fields to find the target ones, and prints them. You could read the result into shell variables like so, then:
read VARA VARB REST <<< $(awk -vRS="],*" -vORS=" " '/rootVolume:false/ for (i=1; i<=NF; i++) if ($i ~ /name' file)
echo $VARA
name:/var/log/devops|40GB;/home/devops|150GB,
echo $VARB
deviceName:/dev/sdb,
Hey, this is near perfect. How can i get only the below details ? example : #awk -vRS="]" '/rootVolume:false/ for (i=1; i<=NF; i++) if ($i ~ /name' /tmp/a | grep deviceName: deviceName:/dev/sdb, I would like to have only /dev/sdb and make that as variable.
â user3179298
Oct 1 at 12:59
Withbash
's "process substitution", you could try like. <(awk -vRS="],*" '/rootVolume:false/ deviceName/) sub (/:/, "="", $i); sub (/,$/,""", $i); print $i' file)
to define the "name" and "deviceName" variables. Watch the leading dot (for "source")!
â RudiC
Oct 1 at 13:27
add a comment |Â
up vote
0
down vote
accepted
up vote
0
down vote
accepted
How far would this get you:
awk -vRS="]" '/rootVolume:false/ for (i=1; i<=NF; i++) if ($i ~ /name' file
name:/var/log/devops|40GB;/home/devops|150GB,
deviceName:/dev/sdb,
It splits the single line at ]
, then scans through all fields to find the target ones, and prints them. You could read the result into shell variables like so, then:
read VARA VARB REST <<< $(awk -vRS="],*" -vORS=" " '/rootVolume:false/ for (i=1; i<=NF; i++) if ($i ~ /name' file)
echo $VARA
name:/var/log/devops|40GB;/home/devops|150GB,
echo $VARB
deviceName:/dev/sdb,
How far would this get you:
awk -vRS="]" '/rootVolume:false/ for (i=1; i<=NF; i++) if ($i ~ /name' file
name:/var/log/devops|40GB;/home/devops|150GB,
deviceName:/dev/sdb,
It splits the single line at ]
, then scans through all fields to find the target ones, and prints them. You could read the result into shell variables like so, then:
read VARA VARB REST <<< $(awk -vRS="],*" -vORS=" " '/rootVolume:false/ for (i=1; i<=NF; i++) if ($i ~ /name' file)
echo $VARA
name:/var/log/devops|40GB;/home/devops|150GB,
echo $VARB
deviceName:/dev/sdb,
answered Oct 1 at 12:09
RudiC
1,8429
1,8429
Hey, this is near perfect. How can i get only the below details ? example : #awk -vRS="]" '/rootVolume:false/ for (i=1; i<=NF; i++) if ($i ~ /name' /tmp/a | grep deviceName: deviceName:/dev/sdb, I would like to have only /dev/sdb and make that as variable.
â user3179298
Oct 1 at 12:59
Withbash
's "process substitution", you could try like. <(awk -vRS="],*" '/rootVolume:false/ deviceName/) sub (/:/, "="", $i); sub (/,$/,""", $i); print $i' file)
to define the "name" and "deviceName" variables. Watch the leading dot (for "source")!
â RudiC
Oct 1 at 13:27
add a comment |Â
Hey, this is near perfect. How can i get only the below details ? example : #awk -vRS="]" '/rootVolume:false/ for (i=1; i<=NF; i++) if ($i ~ /name' /tmp/a | grep deviceName: deviceName:/dev/sdb, I would like to have only /dev/sdb and make that as variable.
â user3179298
Oct 1 at 12:59
Withbash
's "process substitution", you could try like. <(awk -vRS="],*" '/rootVolume:false/ deviceName/) sub (/:/, "="", $i); sub (/,$/,""", $i); print $i' file)
to define the "name" and "deviceName" variables. Watch the leading dot (for "source")!
â RudiC
Oct 1 at 13:27
Hey, this is near perfect. How can i get only the below details ? example : #awk -vRS="]" '/rootVolume:false/ for (i=1; i<=NF; i++) if ($i ~ /name' /tmp/a | grep deviceName: deviceName:/dev/sdb, I would like to have only /dev/sdb and make that as variable.
â user3179298
Oct 1 at 12:59
Hey, this is near perfect. How can i get only the below details ? example : #awk -vRS="]" '/rootVolume:false/ for (i=1; i<=NF; i++) if ($i ~ /name' /tmp/a | grep deviceName: deviceName:/dev/sdb, I would like to have only /dev/sdb and make that as variable.
â user3179298
Oct 1 at 12:59
With
bash
's "process substitution", you could try like . <(awk -vRS="],*" '/rootVolume:false/ deviceName/) sub (/:/, "="", $i); sub (/,$/,""", $i); print $i' file)
to define the "name" and "deviceName" variables. Watch the leading dot (for "source")!â RudiC
Oct 1 at 13:27
With
bash
's "process substitution", you could try like . <(awk -vRS="],*" '/rootVolume:false/ deviceName/) sub (/:/, "="", $i); sub (/,$/,""", $i); print $i' file)
to define the "name" and "deviceName" variables. Watch the leading dot (for "source")!â RudiC
Oct 1 at 13:27
add a comment |Â
up vote
4
down vote
You can use the command cut
something like:
cat /tmp/volume.log | cut -d, -f14 | tr -d "]["
rootVolume=false
make it a variable:
rootvolume=$(cat /tmp/volume.log | cut -d, -f14 | tr -d "][")
cat /tmp/volume.log | cut -d, -f3
deviceName:/dev/sda
cat /tmp/volume.log | cut -d, -f9
name:/var/log/devops|40GB;/home/devops|150GB
Or with grep
cat /tmp/volume.log | grep -o "rootVolume:false]]," | tr "][,"
make it a variable:
rootvolume=$(cat /tmp/volume.log | grep -o "rootVolume:false]]," | tr "][,")
cat /tmp/volume.log | grep -o "deviceName:/dev/sda"
cat /tmp/volume.log | grep -o "name:/var/log/devops|40GB;/home/devops|150GB" | tr -d "n"
-o, --only-matching
Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line.
Use tr
after grep
to remove , ....etc
from your output.
I gave you an example of the text file, but in real we might have more disk's. So I have to grep only the rootvolume=false and once the match is found. Then I need to get the false boot disk name. Then the other partition.
â user3179298
Oct 1 at 11:34
Hi @user3179298. You can change-f14
to match the information you want in the file. Does this make sense?
â Goro
Oct 1 at 11:35
Hello Gora, the Field will change server to server. Some times the field 14 will have root volume disk.
â user3179298
Oct 1 at 12:05
No worries, I will tweak it for you. I thought you have standard files as provided in your example!
â Goro
Oct 1 at 12:06
I have a logic, but not sure how to get that done. i see every disk are start and end with [ ..... ],[.....],[.....] So, i need to grep for root volume=false, then need to take that [......rootvolume=false ] as variable and use sed or cut to get the disk and other volume information's. then i will parse it to the script for LVM creation. But not sure how to :(
â user3179298
Oct 1 at 12:10
 |Â
show 1 more comment
up vote
4
down vote
You can use the command cut
something like:
cat /tmp/volume.log | cut -d, -f14 | tr -d "]["
rootVolume=false
make it a variable:
rootvolume=$(cat /tmp/volume.log | cut -d, -f14 | tr -d "][")
cat /tmp/volume.log | cut -d, -f3
deviceName:/dev/sda
cat /tmp/volume.log | cut -d, -f9
name:/var/log/devops|40GB;/home/devops|150GB
Or with grep
cat /tmp/volume.log | grep -o "rootVolume:false]]," | tr "][,"
make it a variable:
rootvolume=$(cat /tmp/volume.log | grep -o "rootVolume:false]]," | tr "][,")
cat /tmp/volume.log | grep -o "deviceName:/dev/sda"
cat /tmp/volume.log | grep -o "name:/var/log/devops|40GB;/home/devops|150GB" | tr -d "n"
-o, --only-matching
Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line.
Use tr
after grep
to remove , ....etc
from your output.
I gave you an example of the text file, but in real we might have more disk's. So I have to grep only the rootvolume=false and once the match is found. Then I need to get the false boot disk name. Then the other partition.
â user3179298
Oct 1 at 11:34
Hi @user3179298. You can change-f14
to match the information you want in the file. Does this make sense?
â Goro
Oct 1 at 11:35
Hello Gora, the Field will change server to server. Some times the field 14 will have root volume disk.
â user3179298
Oct 1 at 12:05
No worries, I will tweak it for you. I thought you have standard files as provided in your example!
â Goro
Oct 1 at 12:06
I have a logic, but not sure how to get that done. i see every disk are start and end with [ ..... ],[.....],[.....] So, i need to grep for root volume=false, then need to take that [......rootvolume=false ] as variable and use sed or cut to get the disk and other volume information's. then i will parse it to the script for LVM creation. But not sure how to :(
â user3179298
Oct 1 at 12:10
 |Â
show 1 more comment
up vote
4
down vote
up vote
4
down vote
You can use the command cut
something like:
cat /tmp/volume.log | cut -d, -f14 | tr -d "]["
rootVolume=false
make it a variable:
rootvolume=$(cat /tmp/volume.log | cut -d, -f14 | tr -d "][")
cat /tmp/volume.log | cut -d, -f3
deviceName:/dev/sda
cat /tmp/volume.log | cut -d, -f9
name:/var/log/devops|40GB;/home/devops|150GB
Or with grep
cat /tmp/volume.log | grep -o "rootVolume:false]]," | tr "][,"
make it a variable:
rootvolume=$(cat /tmp/volume.log | grep -o "rootVolume:false]]," | tr "][,")
cat /tmp/volume.log | grep -o "deviceName:/dev/sda"
cat /tmp/volume.log | grep -o "name:/var/log/devops|40GB;/home/devops|150GB" | tr -d "n"
-o, --only-matching
Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line.
Use tr
after grep
to remove , ....etc
from your output.
You can use the command cut
something like:
cat /tmp/volume.log | cut -d, -f14 | tr -d "]["
rootVolume=false
make it a variable:
rootvolume=$(cat /tmp/volume.log | cut -d, -f14 | tr -d "][")
cat /tmp/volume.log | cut -d, -f3
deviceName:/dev/sda
cat /tmp/volume.log | cut -d, -f9
name:/var/log/devops|40GB;/home/devops|150GB
Or with grep
cat /tmp/volume.log | grep -o "rootVolume:false]]," | tr "][,"
make it a variable:
rootvolume=$(cat /tmp/volume.log | grep -o "rootVolume:false]]," | tr "][,")
cat /tmp/volume.log | grep -o "deviceName:/dev/sda"
cat /tmp/volume.log | grep -o "name:/var/log/devops|40GB;/home/devops|150GB" | tr -d "n"
-o, --only-matching
Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line.
Use tr
after grep
to remove , ....etc
from your output.
edited Oct 1 at 12:41
answered Oct 1 at 11:29
Goro
7,02252965
7,02252965
I gave you an example of the text file, but in real we might have more disk's. So I have to grep only the rootvolume=false and once the match is found. Then I need to get the false boot disk name. Then the other partition.
â user3179298
Oct 1 at 11:34
Hi @user3179298. You can change-f14
to match the information you want in the file. Does this make sense?
â Goro
Oct 1 at 11:35
Hello Gora, the Field will change server to server. Some times the field 14 will have root volume disk.
â user3179298
Oct 1 at 12:05
No worries, I will tweak it for you. I thought you have standard files as provided in your example!
â Goro
Oct 1 at 12:06
I have a logic, but not sure how to get that done. i see every disk are start and end with [ ..... ],[.....],[.....] So, i need to grep for root volume=false, then need to take that [......rootvolume=false ] as variable and use sed or cut to get the disk and other volume information's. then i will parse it to the script for LVM creation. But not sure how to :(
â user3179298
Oct 1 at 12:10
 |Â
show 1 more comment
I gave you an example of the text file, but in real we might have more disk's. So I have to grep only the rootvolume=false and once the match is found. Then I need to get the false boot disk name. Then the other partition.
â user3179298
Oct 1 at 11:34
Hi @user3179298. You can change-f14
to match the information you want in the file. Does this make sense?
â Goro
Oct 1 at 11:35
Hello Gora, the Field will change server to server. Some times the field 14 will have root volume disk.
â user3179298
Oct 1 at 12:05
No worries, I will tweak it for you. I thought you have standard files as provided in your example!
â Goro
Oct 1 at 12:06
I have a logic, but not sure how to get that done. i see every disk are start and end with [ ..... ],[.....],[.....] So, i need to grep for root volume=false, then need to take that [......rootvolume=false ] as variable and use sed or cut to get the disk and other volume information's. then i will parse it to the script for LVM creation. But not sure how to :(
â user3179298
Oct 1 at 12:10
I gave you an example of the text file, but in real we might have more disk's. So I have to grep only the rootvolume=false and once the match is found. Then I need to get the false boot disk name. Then the other partition.
â user3179298
Oct 1 at 11:34
I gave you an example of the text file, but in real we might have more disk's. So I have to grep only the rootvolume=false and once the match is found. Then I need to get the false boot disk name. Then the other partition.
â user3179298
Oct 1 at 11:34
Hi @user3179298. You can change
-f14
to match the information you want in the file. Does this make sense?â Goro
Oct 1 at 11:35
Hi @user3179298. You can change
-f14
to match the information you want in the file. Does this make sense?â Goro
Oct 1 at 11:35
Hello Gora, the Field will change server to server. Some times the field 14 will have root volume disk.
â user3179298
Oct 1 at 12:05
Hello Gora, the Field will change server to server. Some times the field 14 will have root volume disk.
â user3179298
Oct 1 at 12:05
No worries, I will tweak it for you. I thought you have standard files as provided in your example!
â Goro
Oct 1 at 12:06
No worries, I will tweak it for you. I thought you have standard files as provided in your example!
â Goro
Oct 1 at 12:06
I have a logic, but not sure how to get that done. i see every disk are start and end with [ ..... ],[.....],[.....] So, i need to grep for root volume=false, then need to take that [......rootvolume=false ] as variable and use sed or cut to get the disk and other volume information's. then i will parse it to the script for LVM creation. But not sure how to :(
â user3179298
Oct 1 at 12:10
I have a logic, but not sure how to get that done. i see every disk are start and end with [ ..... ],[.....],[.....] So, i need to grep for root volume=false, then need to take that [......rootvolume=false ] as variable and use sed or cut to get the disk and other volume information's. then i will parse it to the script for LVM creation. But not sure how to :(
â user3179298
Oct 1 at 12:10
 |Â
show 1 more 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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f472553%2fhow-to-print-the-matching-value-from-same-line-which-has-multiple-delimiter%23new-answer', 'question_page');
);
Post as a guest
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
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
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