Question: PART 3: Explore grep filter commands in Chapter 10: grep root passwd.bak grep - e root -e amorris passwd.bak ps -ef | grep your username
PART 3: Explore grep filter commands in Chapter 10:
- grep "root" passwd.bak
- grep - e "root" -e "amorris" passwd.bak
- ps -ef | grep "your username" NOTE: replace "your username" with your actual username on the general
- grep "nobody" passwd.bak5
- grep "^nobody" passwd.bak5
- grep "[n*]obody" passwd.bak5
- grep "bash$" passwd.bak5
- TO HAND IN: Take a screen shot of these commands plus their execution for PART 3.
PART 4:
Explore sed filter commands in Chapter 10:
- sed '5q' passwd.bak5
- sed - n '1,5p' passwd.bak5
- sed -n '5,8p' passwd.bak5
- sed -n -e '5,8p' -e '20,24p' passwd.bak5
- sed -n '$p' passwd.bak5
- sed -e '/:x:0/w passwd.root.bak' passwd.bak5
- vi myscript.sh NOTE: Develop your own short script
- sed '1i\#just a comment\' myscript.sh > myscript2.sh
- sed 's/:/|/g' passwd.bak5 | head
- ls -al | sed '/^.....w/p' NOTE: See files with write group permissions
- vi teledir.txt and add the following text:
charles harris 98310200987
bill Johnson 327-100-2345
robert dylan 9632454090
john woodcock 2344987665
barry wood 234-908-3456
gordon lightfoot 345-987-4670
- sed 's /\([a-z]*\) *\([a-z]*\)/\2, \1/' teledir.txt | sort
- TO HAND IN: Take a screen shot of these commands plus their execution for PART 4.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
