I am capturing the LVs and VGs.
$ lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root rhel -wi-ao---- <12.81g
swap rhel -wi-ao---- 1.60g
lv_hana_backups vg_hana_backups -wi-ao---- <10.00g
lv_hana_data vg_hana_data -wi-ao---- <10.00g
lv_hana_log vg_hana_log -wi-ao---- <10.00g
lv_hana_shared vg_hana_shared -wi-ao---- <10.00g
Piping lvs output into awk piping into tail to only return the columns and lines I need.
lvs | awk '{print $2$1}' | tail -n +4
Which outputs...
vg_hana_datalv_hana_data
vg_hana_loglv_hana_log
vg_hana_sharedlv_hana_shared
I want to insert the text /dev/ at the beginning of column2 for each line and insert a literal slash '/' between the column2 and column1, so it reads like:
/dev/vg_hana_backups/lv_hana_backups
/dev/vg_hana_data/lv_hana_data
/dev/vg_hana_log/lv_hana_log
/dev/vg_hana_shared/lv_hana_shared
How would I do that?
Using the following to simulate OP's
lvsoutput:One
awkidea to replace OP's currentawk ... | tail ...:NOTE: OP will replace
cat lvs.out |withlvs |This generates: