Category Archives: Scripting

Scripting

Useful awk commands

The basic function of the awk command is to search files for lines ( or other units of text) that contain certain patterns. When a line matches one of the patterns, awk performs specified actions on that line.  Print all directories in a folder to file listofall: ls -al | grep ^d | awk ‘{print …

Scripting

Useful sed commands

Sed is another great tool just like awk that can come in handy.  If you do your own scripting or want to see how sed works, take a look at some of one liners some of the folks at Webair put together below. Print Nth line from file: Example: sed -n ‘3,3p’ config.php    Replace text …