SlideServe
Menu
Preferences
© SlideServe · v2026

UNIX commands

mac avatar
3 slides · 420 Views · 30 likes · Aug 31, 2014

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

UNIX commands - slide 1
01 / 3UNIX commands
1 / 17

Download Presentation

UNIX commands
An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

More Related Content

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 3rd 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