shell scripts for DevOps
1.Printing 2.Variables 3.Conditions 4.Functions 5.Loops 6.SED Editor
1.Delete a line 2.Add aline 3.Change a line 4.Search and replace a word
- Display the changes on screen
sed 'ACTION ' file
- Edit the file
sed -i 'ACTION' file
1.Line Number based 2.String search based
Example like , if we wan to delete a line.
For line no criteria
For search string criteria
sed '/word/ d' file
Both the above examles will be just displaying the output, However if we want to edit the file
sed -i 'ld' file
sed -i '/word/ d'file