Questions

1:Using sed, write a shell function that searches for a word or simple expression in a list of files, printing out a list of matches.

You do not have to support all possible sed expressions. Your function should take the word to look for as its first argument. It should treat its other arguments as a list of files.

HINT: Use double quotes (") instead of single quotes (') to surround your sed script.

2:Write a sed command that takes as its input the output of the uptime command and prints only the load averages. The uptime command's output resembles the following:
$ uptime
6:34pm  up 2 day(s), 49 min(s),  1 user,  load average: 0.00, 0.00, 0.02

Your output should resemble the following:

load average: 0.05, 0.01, 0.03
3:Write a sed command ...

Get Sams Teach Yourself Shell Programming in 24 Hours, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.