Shell scripting cheatsheet
SED : it is used to replace a word Replace a word in a file:sed 's/old_word/new_word/' file.txt Replace all occurrences of a word in a file:sed 's/old_word/new_word/g' file.txt Delete lines matching a pattern:sed '/pattern/d' file.txt AWK: Print specific columns from a CSV file:awk -F ',' '{print $1, $3}' file.csv Calculate the sum of a column in a numeric file: awk '{sum += $1} END {print sum}' file.txt Filter lines based on a condition:awk '$3 > 50 {print $1, $3}' file.txt Shebang: The shebang, also known as a hashbang, is the first line of a script and specifies the interpreter to use. For example, #!/bin/bash Variables: Variables store data for later use. $name. To declare a variable as global, use the export keyword. Command substitution: For example, files=$(ls) stores the output of the ls command in the files variable. Control structures: if-else: Conditionally execute code based on a condition. It has the form: if co...