I am preparing for lpic-1 exam and wanted to create a list of topics plus the weight of it with some adventurous curl.
the outcome I aim for would be something like
101.1 Determine_and_configure_hardware_settings 2
101.2 Boot_the_system 3
101.3 Change_runlevels_.2F_boot_targets_and_shutdown_or_reboot_system 3
...
the below gets me quite far
❯ curl -s https://www.lpi.org/our-certifications/exam-101-102-objectives/ | egrep -A7 -e 'id="10[0-9].[0-9]' | egrep '#eaeaea|^<h4>' | awk {'print $3'} | sed 's/id="//' | sed 's/"><span$//' | sed 's/_/ /' | head
101.1 Determine_and_configure_hardware_settings
2
101.2 Boot_the_system
3
101.3 Change_runlevels_.2F_boot_targets_and_shutdown_or_reboot_system
3
102.1 Design_hard_disk_layout
2
102.2 Install_a_boot_manager
2
left aside whether this is the most efficient or beautiful pipeline, I can't figure out how the get from
102.1 Design_hard_disk_layout
2
102.2 Install_a_boot_manager
2
to
102.1 Design_hard_disk_layout 2
102.2 Install_a_boot_manager 2
played a bit with 'tr' which only got me to loss lines completely
102.1 Design_hard_disk_layout 2 102.2 Install_a_boot_manager 2
any hint?
egrepandfgrepare deprecated. Better to usegrep -Eandgrep -Finstead. They still work, but they can be removed at any time, so it's a good idea to get into the habit of using the options instead.grep -Eoveregrep. But when the gods of bash think so, I am sure they have their reasons.grep -Ebutegrepisn’t likely to go away any time soon.