Category: Bash

Bash basics example

List the number of lines in all of the csv data files. wc -l *.csv Next, remove the line containing the word “total”. wc -l *.csv | grep -v total Display the line with fewest number of lines wc -l

Bash basics 2

Summary: head and tail select rows, cut selects columns, and grep “phrase” selects lines that contain “phrase“. Note: grep -v: invert the match, i.e., only show lines that don’t match ** Writing to an output file command > output_file **

Bash basics

Environmental variables — are in all caps. E.g HOME, USER — the set command displays all the environmental variable Getting the value of an environmental variable: 1. echo $HOME — note the $ as the first character 2. set |