Presentation is loading. Please wait.

Presentation is loading. Please wait.

UNIX commands Head More (press Q to exit) Cat – Example cat file – Example cat file1 file2 Grep – Grep –v ‘expression’ – Grep –A 1 ‘expression’ – Grep.

Similar presentations


Presentation on theme: "UNIX commands Head More (press Q to exit) Cat – Example cat file – Example cat file1 file2 Grep – Grep –v ‘expression’ – Grep –A 1 ‘expression’ – Grep."— Presentation transcript:

1 UNIX commands Head More (press Q to exit) Cat – Example cat file – Example cat file1 file2 Grep – Grep –v ‘expression’ – Grep –A 1 ‘expression’ – Grep –B 2 ‘expression’ – Example: grep –v ‘#’ file.txt to remove comments Expression metacharacters – $ end of line – $ beginning of line – [AB] A or B – * any character – Example: ‘CDKN*’ or ‘chr[1-7]’

2 UNIX commands Cut –cut –f 1 –cut –f 3 –d ‘:’ Sort –sort –n –sort –nr (or sort –n –r) –sort –k 2 uniq –uniq –uniq -c wc –wc –l file.txt –Example: cut –f 1 file | sort | uniq -c

3 UNIX commands Sed –Sed ‘s/foo/bar/g’ file : find and replace Awk –Awk ‘$3>2000’ file : select row with 3 rd field>2000 –Awk ‘{if ($3>2000) print $1,$2}’ file only print first 2 columns –Awk ‘{sum+=$3} END {print sum}’ file print sum of column 3 –Awk ‘{sum+=$3} END {print sum/NR}’ file print average of column 3 Join –join –j 1 sorted_file1 sorted_file2


Download ppt "UNIX commands Head More (press Q to exit) Cat – Example cat file – Example cat file1 file2 Grep – Grep –v ‘expression’ – Grep –A 1 ‘expression’ – Grep."

Similar presentations


Ads by Google