- Basic Information
- Check Shells
- Sample Hello Script (Echo Commands Options)
- re-direct to output into file
- creating file and adding the data while executing script
- adding new data instead of replacing
- Comments
- quotes
- HereDOC -- What ever we are going to write in scrpit: it will visible on output
- Script Inputs ( Arguments, Read, STDIN)
- Script Outputs (STDOUT , STDERR)
- Variables
- Command Arguments
- Example Script1 ( Echo, variables, arguments)
- Ex : Create no of files
- Ex: Send output from one script to another script
- Arithmetic Operators
- File Operators for finding (-f, -d, -s, -w, -r, -x)
- Ex: Numeric and Athematic Operations : Arithmetic Operations
- Ex: Numeric and Athematic Operations: converting-list-of-hexadecimal-numbers
- Test Commands (integral part of the conditional statements)
- Functions
- Conditional Statements (IF, if-else, if-else-if, case)
- Loop Statements (For, While, Until)
- Conditional Statements (Example)
- Conditional / Loop Examples
- Loop Statement Ex: Get all test files size and Move 0KB files into separate folder
- Break & Continue statements
- String Processing - comparing strings
- String Processing - Comparing Length of strings
- String Processing - String concatenation
- String Processing - script for upper and lower cases
- Grep(global regular expression print) : Search string in the File : Example 1
- Grep : Search string in the File from given path : Example 2
- Grep : Case Sensitive (-i)
- Grep : Case sensitive & For Line Numbers (-n)
- Grep : count of lines which is contains the given text (-c)
- Grep : count of lines which is not contains the given text(-v)
- Grep : Display's the lines after the results( -A, -B, -C)
- AWK : print a file
- AWK : search for a specific pattern using ‘awk’
- AWK : extract the content from the lines, where the program found its targeted word.($1, $2)
- AWK : To print the first item along with the row number(NR) separated with ” – “ from each line
- AWK : To print any non empty line if present
- AWK: To print the squares of first numbers from 1 to n say 6:
- AWK: To find/check for any string in any specific column:
- AWK: Printing lines with less than 20 characters:
- AWK: To find the length of the longest line present in the file:
- SED - Stream editor - Changing one letter --> 's/i/I/'
- SED - Changing all letters --> 's/i/I/g' --> Global Replacement
- SED - Substitute word
- SED - Case Sensitive (-i)
- SED - Removing lines /d
- SED - Displaying multiple consecutive lines--------->>sed -n '1p' <filename>
- SED - Reading Commands From another File--------->>sed -f <sed file> <file name>
- SED - Replacing words in selective lines->> '1,3s/word/relaceword/'
- SED - Replacing selective occurrence (sed 's/unix/25555/4i' $fileName )
- SED - Printing lines that contain a particular word (sed -n '/WIndows/p')
- SED - Transformation of Characters----------->>>'y/abc/123/'
- SED - To delete any blank records- awk -F " " '{print $4}' | sed '/^$/d'
- SED All Commands
=========================================================================Some More Example Scripts=========================================================================
- Test File existence
- Check if User is Root
- Print Number of Files and Folders in given directory
- Find Duplicate files by name
- Find Duplicate lines and Count for all files in the directory
- Lines count $ words count of all files in given directory
- Get Databases & tables List
- create new database from existing database and extract all tables from old DB to new DB
- Get all tables record count from Old DB & New DB
- Record Count Script with Alert Message
- Find Greater number from given 5 numbers(else-if)
- Get file size for all tables and moving 0KB files to another folder
- Print Chess board
- Difference of 2 files
- Difference of all files
- Interview Ques: Printing Custom rows and columns (By using AWK)
- Interview Ques: Convert Row values Positive to Negative
- Interview Ques: Convert Column values Positive to Negative
- Test File existence
- Check if User is Root
- Print Number of Files and Folders in given directory
- Find Duplicate files by name
- Find Duplicate lines and Count for all files in the directory
- Lines count $ words count of all files in given directory
- Get Databases & tables List
- create new database from existing database and extract all tables from old DB to new DB
- Get all tables record count from Old DB & New DB
- Record Count Script with Alert Message
- Find Greater number from given 5 numbers(else-if)
- Get file size for all tables and moving 0KB files to another folder
- Print Chess board
- Difference of 2 files
- Difference of all files
- Interview Ques: Printing Custom rows and columns (By using AWK)
- Interview Ques: Convert Row values Positive to Negative
- Interview Ques: Convert Column values Positive to Negative