Download presentation
Presentation is loading. Please wait.
Published byImogen Wilkins Modified over 8 years ago
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.