Hands-on task
This task is step 13 of the course “Text in the terminal: grep, sed, awk”
sed: lines for /etc/hosts
/root/servers.txt has lines of the form name ip (for example, db-01 10.0.2.21). /etc/hosts needs the reverse order: ip name. Swap the columns using sed and write the result to /root/hosts.part.
What you'll practise:
- sed -E
- capture groups
- backreferences
- field swapping