From the course: Linux Bash Shells and Scripts: Streamlining Tasks and Enhancing Workflows with Automation

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Solution: sed and AWK

Solution: sed and AWK

(bright music) - [Instructor] Let's look at solutions. So the first one had to do with processing the output of ls -s with set and so forth. So let's just take a look. There's the output of ls -s. And remember, if we pipe it, it'll be all in one column. So if we just did, for example, looking at a little bit of that. We'd get the total and we'd get those numbers. Let's look at a solution here. So it's just a set substituting from a space. the .* that's a regular expression. We haven't really talked about that much, but that essentially matches everything. And the dollar sign there is end of line. So that's going to match from the first base all the way to the end of the line, and it's going to replace that with nothing, //. And then we do another command. The semicolon there, we're going to delete line one, 1d. So if we do the ls -s |challenge4.sh. Oops, got to tell it where to get it. ./ we see all those fours. But quickly, let's look at another example. Let's look at the size of…

Contents