Skip to main content
editorial
. 2021 Feb 18;17(2):e1008645. doi: 10.1371/journal.pcbi.1008645

Table 1. Basic usage examples of the grep, awk, and sed commands.

Command Example Description
grep grep "chr5" file Print all lines that contain the string "chr5" in the named file
awk awk '$1 == 5 {print $2, $3}' file For rows in the named file where the value in column 1 is equal to 5, print columns 2 and 3
sed sed 's/sample1/ID7037/g’ file Replace all occurrences of "sample1" with "ID7037" in the named file and print the result