Awk
Search and field separator - awk
This returns the users with access to bash
awk -F ':' '/\/bash/ {print $1}' /etc/passwd
-Fis the field separator with:
Seaching for/bashin the file
Search and replace
Replace FIRST instances with sub()
Search for the string SEARCH-STR and replace with REPLACE-STR
awk '{sub(/SEARCH-STR/, REPLACE-STR); print}' <file>
sub();to find first instance of theSEARCH-STRand substitute withREPLACE-STR
Replace ALL instances with gsub()
awk '{gsub(/SEARCH-STR/, REPLACE-STR); print}' <file>