System Directory Hierarchy - Cornell Universitychagall.med.cornell.edu/UNIXcourse/UnixSlides.pdf ·...

Post on 25-Nov-2018

216 views 0 download

Transcript of System Directory Hierarchy - Cornell Universitychagall.med.cornell.edu/UNIXcourse/UnixSlides.pdf ·...

System Directory Hierarchy

homes050

unixst02 othersothersothersunixinst unixst01

quotationQuotationsequences bin

a4_bovin.sw 1O91.pdb others

pbtech_mounts

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

1

/

homes050

unixst02 othersothersothersunixinst unixst01

quotationQuotationsequences bin

a4_bovin.sw 1O91.pdb others

pbtech_mounts

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

2

/

Relative Pathnamescat ../unixinst/quotation

Your Directory Hierarchyunixstxx

human

dat

struct seq

cow

struct seq

rodent

struct seq

*.pdb *.fasta *.pdb *.pdb*.fasta *.fasta

othersothersothers

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

3

stdout

UNIX Commands: No Redirectionsort

stdin

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

stderr

4

stdout

UNIX Commands: Redirect inputsort < in.txt

stdin

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

stderr

5

stdout

UNIX Commands: Redirect Outputsort > sorted.txt

stdin

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

stderr

6

stdout

UNIX Commands: Redirect Outputsort > sorted.txt 2> err.log

stdin

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

stderr

7

stdout

UNIX Commands: Combined Redirection

sort > sorted.txt 2>&1

stdin

stderr

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

8

stdout

UNIX Commands: More examplessort < in.txt > sorted.txt

stdin

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

stderr

9

stdout

UNIX Commands: More examplessort < in.txt >> sorted.txt

stdin

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

stderr

10

UNIX Commands: More examples sort < in.txt > sorted.txt 2>&1

stdoutstdin

stderr

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

11

UNIX Commands: Pipesegrep PAT < in.txt | sort | head -1 > first.txt

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

12

The csplit Commandcsplit seq.fasta '%^>%' '/^>/' '{3}’

csplit seq.fasta '%^>%' '/^>/' '/^>/' '/^>/' '/^>/'

xx00

xx01

xx02

xx03

xx04

5 patterns = 6 groups• Lines before the first match.• Lines from the first match up to

(but not including) the second match.• Lines from the second match up to

(but not including) the third match.• Lines from the third match up to

(but not including) the fourth match.• Lines from the fourth match up to

(but not including) the fifth match.• Lines from the fifth match up to

the end of the file.

>seqAMNSGVRMVTRSKVPVWEPQNWQ>seqBMEPPVPQSSVPGPPELAPTPAR>seqCPLDLKGPTAPPCTNEDDEGSCA>seqDSVICKAASGDTMNWNNITLTIV>seqESFRNFLGDIGCLISSNLLSYIK

%pattern% skip over this group (no file)/pattern/ create file for this group{n} repeat previous pattern n times

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

13

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

Modes of vi

SURF

EDIT

COMMAND

Aa

Ii

Oo

:

:wq

:q!

<Esc>

14