← Shell Scripting (Bash) learning pathShell Scripting (Bash) · Module 8 of 10
Functions and text processing
Reuse code with functions and process text with sed and awk.
📖 Key ideas
- Functions: greet() { echo "Hi $1"; }.
- local keeps variables inside functions.
- sed edits streams: sed 's/old/new/g' file.
- awk processes columns: awk '{print $1}' file.
- find searches files: find . -name "*.jpg".
💡 Real-life example: sed is find-and-replace; awk is a mini spreadsheet for text columns.
FunctionReusable named block
localFunction-scoped variable
sedStream editor
awkColumn-based text processor