Upload
lcm3766l
View
254
Download
0
Embed Size (px)
Citation preview
8/20/2019 Intro Linux Awk
1/51
NMR Spectroscopy and Protein Structures
Chem 991A Special Topics in Physical Chemistry
Lectures: MWF 10:30am-11:0am! "m #33 $amilton $all
Class Pro%ects & '(ams: Thur) *:00-+:00pm! "m #33 $amilton $all
COURSE OUTLINE
Instructor: ,r) "oert Po.ers /ice Las
Aress: # $a$ #1 $a$Phone: 2#-3039 Phone: 2#-31*e-mail:rpo.ers34unl)eu .e pa5e: http:66ionmr)unl)eu6
/ice $ours: 11:30-1:30 am MWF or y Special Appointment)
Required Text:
7) 8) S) 'ans! iomolecular 8M" Spectroscopy! /(or ;niersity Press Recommended Text:
M) $) Leitt! Spin ,ynamics < asics o 8uclear Ma5netic "esonance! Wiley
8/20/2019 Intro Linux Awk
2/51
=8M" o Proteins an 8ucleic Acis> ?urt Wuthrich
=Protein 8M" Spectroscopy: Principals an Practice>
7ohn Caana5h! Arthur Palmer! 8icholas 7) S@elton! Wayne Fairrother
=Principles o Protein Structure> ) ') SchulB & ") $) Schirmer
=ntrouction to Protein Structure> C) ranen & 7) TooBe
='nBymes: A Practical ntrouction to Structure! Mechanism! an ,ata Analysis> ")Copelan
=iophysical Chemistry> Parts to ! C) Cantor & P) Schimmel
=Principles o 8uclei Aci Structure> W) Saen5er
Some Other Recommended Resources
Course /utline Dcont)E
8/20/2019 Intro Linux Awk
3/51
Some Important Web Sites:
"CS Protein ,ata an@ DP,E ,ataase o 8M" & -ray Structureshttp:66...)rcs)or56p6
M" DioMa5"esan@E ,ataase o 8M" resonance assi5nmentshttp:66...)mr).isc)eu6
CAT$ Protein Structure Classiication Classiication o All Proteins in P,http:66...)cath)ino6
SC/P: Structural Classiication o Proteins Classiication o All Structures intohttp:66scop)er@eley)eu Families! Super Families etc)
P,eFol Compares 3,-Stuctures o Proteins to
http:66...)ei)ac)u@6ms-sr6ssm6 ,etermine Structural Similarities o 8e.Structures
8M" normation Serer 8M" roups! 8e.s! Lin@s! Conerences! 7oshttp:66...)spincore)com6nmrino6
8M" ?no.le5e ase A lot o useul 8M" lin@shttp:66...)spectroscopyno.)com6
Course /utline Dcont)E
8/20/2019 Intro Linux Awk
4/51
Course /utline Dcont)E Course Work:
/ral "eports DE: 100 pts Dariale ue atesE;iGuitin Assi5nment 100 pts Due ,ec) 13EProlem Set: 100 pts Due ,ec) 13E'(am 1: 100 pts DThur)! /ct) 3E'(am : 100 pts DThur)! 8o) #EFinal '(am: 00 pts DFri! ,ec) 0! 10am-1pmE
Total: #00 pts)
Ans.er @eys or the prolem sets an e(ams .ill e poste on lac@oar)
Grading scale: AHI9JK AI90JK A-I+JK HI+0JK I#JK -I#0JK
CHI*JK CI*0JK C-IJK ,I0JK ,-I2JK FI20J
8/20/2019 Intro Linux Awk
5/51
Class Participation
"eain5 assi5nments shoul e complete prior to each lecture) The reGuire te(t.ill only supplement the lecture material) A ast ma%ority o the material or the class.ill come rom the lectures)
You are expected to participate in ALL classroom discussions
Exams
All e(ams De(cept the inalE .ill ta@e place at * pm in $amilton $all "m) #33 on thescheule ate)
The len5th o each e(am De(cept the inalE .ill e open-ene) ou .ill hae as
much time as neee to complete the e(am)
rin5 TI-8 style calculator or a simpler moel! an an approe translator ireGuire)
A reie. session .ill ta@e place urin5 the normal class time prior to each e(am)
!L"!#S S$O" !LL "OR%&&&&
Course /utline Dcont)E
8/20/2019 Intro Linux Awk
6/51
Lecture Topics 'Tentati(e Sc)edule*
+ate Topic C)apter I, O(er(ie o. Protein Structures
Au5 * ntrouction Au5 + Linu( an A.@
Au5 30 Protein Structures rom an 8M" Perspectie 2Sept 2Sept *Sept 9Sept 11Sept 13Sept 1*
Sept 1+Sept 0Sept 3Sept Protein Moelin5 Sot.are 3)9Sept #Sept 30/ct Oct / E0!M 1
/ct 2 Molecular Mechanics an ,ynamics 3)-3)9/ct #/ct 9 Comparison o -ray an 8M" Structures/ct 11/ct 12 sotope Laelin5 o Proteins 2)) < 2))3/ct 1*
II, NMR !ssi2nment Pro3lem
/ct 1+ 8M" Sot.are 3)9Oct 21 to Oct 22 Fall Break
8/20/2019 Intro Linux Awk
7/51
Lecture Topics 'continue*
+ate Topic C)apter /ct 3/ct , 8M" )1/ct +
/ct 30 3, 8M" )8o 1 2, 8M" )3
III, NMR Structure +etermination 38o 2 8/'s 3)18o *No( 4 E0!M 58o +
8o 11 Chemical shits! Couplin5 constants! Amie '(chan5es 2)1)2! 3)! 2)1)3! )8o 138o 1 Stereospeciic assi5nments! ",Cs 2)1)8o 1+ Nuality o 8M" Structures 3)108o 0
I6, Protein +ynamics 1)3!1)2!8o T1!T! 8/' & S
8o
Nov 27 to Nov 2 !"anksgiving 6, Protein-Li2and Structures *)3
,ec SA" y 8M"! /ther 1, an , Methos,ec 2 Transer 8/' *),ec * Filtere & eite 8M" e(periments,ec 9 Metaolomics *)#,ec 11
,ec 13 #ro$lem %et & '$i(uitin Assignment due+ec 57 IN!L E0!M
8/20/2019 Intro Linux Awk
8/51
/"AL P"'S'8TAT/8 /F ST";CT;"' PAP'"S
< T.o 0 minute /ral Presentations Thursay 'enin5s at *pm in $a$ #33
Auience Participation is '(pecte Dli@e a %ournal cluE
Presentation ,ates "anomly Assi5ne Dsee syllaus pa5e 2E
0 points per presentation < total o 100 points
< Paper o our Choice A Protein Structure Shoul e a Ma%or Focus o the Paper
The Paper Topic Shoul e o eneral nterest an o Si5niicant mpact
Sen an 'lectronic Copy o the Paper to the Class Prior to ourPresentation
< Some "ecommene Sources Nature Structural Biolog! Science! Nature! Cell! "olecular Cell!
Structure! #rotein Science! #N$S! %ournal o& "olecular Biolog!
Biochemistr! and %ournal o& Biomolecular N"R'
The paper may coer a protein structure or a protein-comple( Dsmall
molecule! protein! ,8A! "8A! etcE)
8/20/2019 Intro Linux Awk
9/51
/"AL P"'S'8TAT/8 /F ST";CT;"' PAP'"S
< Presentation oal
Present a Clear ;nerstanin5 o the oals an Finin5s o thePaper to the Class
Wh (as the particular protein the target o& the paper)
*o( (as the structure determined) Were there an challengingissues)
What structure (as determined &or the protein +&old), What are some interesting &eatures o& the structure +dnamics,)
$re there an unique structural di&&erences compared to othermembers o& the &amil)
What structural &eatures are important to &unction)
*o( (as the structure used to support or re&ute the biological &ocuso& the paper)
-oes the structure actuall support the conclusion or did theauthor.s o/er interpret the data)
-oes the data0structure suggest other equall plausible
conclusions)
8/20/2019 Intro Linux Awk
10/51
/"AL P"'S'8TAT/8 /F ST";CT;"' PAP'"S
< rain5
Comination o My Assessment an the /ther StuentsO Assessment
'ach Stuent .ill e Limite to iin5 Appro(imately 30J As! Js! An 1J Cs
,eault rae is a ! an A or C .ill "eGuire 7ustiication
All the assessments .ill e aera5e to5ether to etermine the
numer o points
< Assessin5 the Presenter
$o. .ell i the presenter unerstan the material
$o. clearly i the presenter iscuss the material
Was the chosen paper o 5eneral interest an iolo5ically si5niicant
Was the structure releant an important to the paper
$o. .ell i the presenter ans.er Guestions
,i the paper lea to an interestin5 iscussion
Average Assessed Grade: A: 0pts! H: 2pts! : 20pts! -: 3pts! CH: 30pts! C: pts
8/20/2019 Intro Linux Awk
11/51
/"AL P"'S'8TAT/8 /F ST";CT;"' PAP'"S
Oral Presentation Schedule
9/5 9/12 9/19 9/26 10/10
Jonathan Catazaro Mark Carter Bradley Worley Teklab Gebregiworgis Jonathan Catazaro
Jeffrey Jeppson Jessica Periago Shulei ei !arrell Marshall Jeffrey Jeppson
10/17 10/24 11/14 11/21 12/5
Mark Carter Bradley Worley Teklab GebregiworgisJessica Periago Shulei ei !arrell Marshall
12/12
!entative %c"edule
8/20/2019 Intro Linux Awk
12/51
Course Assi5nments
< T.o Separate rae Assi5nments A stanar prolem set < included at the end o& the sllabus
An 8M" assi5nment prolem
,ue ata or oth assi5nments is the e5innin5 o class on Fri) ,ec) 13
Late Pro3lem Sets ill NOT 3e accepted
< rain5 - eneral
'ach Assi5nment is .orth 100 pts) D00 pts) totalE
Sho. ALL .or@ to receie ull creit
ou must sumit your o.n set o ans.ers
< Some Aitional Consierations
Please start oth assi5nments 8/WQ
Please .or@ to5ether
Please isit my oice hours or assistance
8/20/2019 Intro Linux Awk
13/51
Course Assi5nments
< The Stanar Prolem Set $as T.o Sections Writin5 simple AW? pro5rams to manipulate iles
;sin5 plor an other sot.are to analyBe protein structures
,ue ate or oth assi5nments is the e5innin5 o class on Fri) ,ec) 13
Late Pro3lem Sets ill NOT 3e accepted
< rain5 < Stanar Prolem Set
8o uniGue ans.er or pro5ramin5 section! either it .or@s or it oesnOt
'-mail me your scripts an .ill run them
it .or@s ull creit! i not Bero points
The analysis o the protein structures section .ill hae eine ans.ers
Please sumit the ans.ers to the protein structure section on the ueate
8/20/2019 Intro Linux Awk
14/51
Course Assi5nments
< 8M" Assi5nment Prolem Set
,etermine the ac@one 8M" Assi5nments or ;iGuitin
The complete pro%ect shoul inclue a coer pa5e that summariBes yourassi5nments usin5 the ollo.in5 template:
"es $8 18 Ca C CaDi-1E CDi-1E C/Di-
1E
M1N3)))
#*
1 10 20 30 40
Sequence: MQIFVKTLTG KTITLEVEPS DTIENVKAKI QDKEGIPPDQ
50 60 70 76
QRLIFAGKQL EDGRTLSDN IQKESTL!LV LRLRGG
8/20/2019 Intro Linux Awk
15/51
Course Assi5nments
< 8M" Assi5nment Prolem Set
ou .ill ALL hae access to a stanar ataset o 8M" spectra: , 1$-1$SNC! , 1$-13C $SNC! 3, $8C/! 3, $8CA! 3, CCA8$! an 3,
CCAC/8$
,ata .ill e aailale on the computers in the "esearch nstrument 8M"Facility D$a$ +3E
All the necessary sot.are or the processin5 an analyBin5 o the ata.ill also e aailale on these computers
< oal
Assi5n the minimal set o ac@one resonances D$8! 18! 13C/! Cα! CβE
Proie practical e(perience .ith usin5 8M" ata to assi5n a protein Complete as much o the ac@one assi5nments as possile
< rain5 < 8M" Assi5nment Prolem Set
ase on ho. complete the assi5nments are
Scale ase on oerall success o the class
8/20/2019 Intro Linux Awk
16/51
Introduction to Linux/Unix
Linux: A ;8
8/20/2019 Intro Linux Awk
17/51
Introduction to Linux/Unix
!)pical Linux %"ell *nvironment !)pical Linux +,indo-s. *nvironment
Simple 9command line: execution o.pro2rams or editin2 o. .iles
Mimics PC?Mac des>top
8/20/2019 Intro Linux Awk
18/51
Introduction to Linux/Unix
/onnecting 0rom a #/ $) a !erminal*mulation %o0t-are #u!!Y /onnecting 0rom a #/ $) %am$a
command line en(ironment PC?Mac .older en(ironment
8/20/2019 Intro Linux Awk
19/51
Introduction to Linux/Unix
< raphical ;ser nterace D;E or PC6MAC ,es@top 'nironment
ou can use the ,es@top li@e a PC! ut can e cumersome Minimal Di any E stanars! eerythin5 in the enironment nees to e
coni5ure
,o.nsie o open-source DreeE sot.are < many contriutors .ith little to no
mana5ers
< More common to .or@ in a shell usin5 the comman line
Primitie D=/l School>E Minimal mouse unctions! pull o.n menus or other common eatures .e are
accustom to 8ee to memoriBe commans an options D=la5s>E
8ee to open a Terminal! Wino. or Shell "i5ht clic@ mouse an select =open terminal>
8/20/2019 Intro Linux Awk
20/51
Introduction to Linux/Unix
< Three Common Linu( Commans: pd! ls an cd
pd < ientiies the current path or irectory
ls < list the iles an olers in the current irectory cd path - moe to the eine path Dchan5e irectoryE
‒ cd ,, Dmoe up one irectoryE!
‒ cd ,,?,, D moe up t.o irectoriesE
8/20/2019 Intro Linux Awk
21/51
Introduction to Linux/Unix‒ For a Complete List o Linu( Commans an '(planations see
http:66linu(comman)or56 /r the oo@ =Linu( in a 8utshell>
‒ Some /ther Common Commans ec)o 9text1 2 isplay or print text exit 2 close a terminal
clear < clear all te(t in a terminal m>dir - ma@e a ne. irectory rm - remoe6elete ile m( - moes iles cp - copies iles ps < lists all actie user pro5rams an isplay a P, Dprocess ientiication
numerE >ill pid - .ill @ill DstopE the process .ith the liste pid numer man command - .ill isplay the manual or the liste command cat &ile 2 isplay the contents o a &ile Dalso use to comine or
concatenate multiple ilesE (i &ile 2 .ill open &ile .ith a primitie te(t eitor
c)mod &ile &lags < .ill chan5e or set permissions or &ile eine y &lags
8/20/2019 Intro Linux Awk
22/51
Introduction to Linux/Unix‒ t ets More ComplicateQ
‒ A numer o commans hae a ran5e o options that are implementeon the comman line .ith a =la5>
ls ;l - lists iles an olers .ith associate permissions
rm ;R - remoe6elete oler
m( ;i < prompt eore oer.ritin5 an e(istin5 ile .ith the same name
cp ;n < o not oer.rite an e(istin5 ile .ith the same name
cp ;u
8/20/2019 Intro Linux Awk
23/51
Introduction to Linux/Unix
‒ /ne More Rery ;seul Comman
‒ sort
Nuic@ly re-orer or sort the ro.s o a taular ile .ith n numer o columns
sort
8/20/2019 Intro Linux Awk
24/51
Permissions‒ ou canOt rea! .rite! eit or e(ecute a ile .ithout permissionQ
,irectory
8umer o ilesin ,irectory
File /.ner
roup /.nerelon5s to
SiBe o ile in@iloytes Filename
File ,ate orTime Stamp
8/20/2019 Intro Linux Awk
25/51
Permissions‒ "eain5 an unerstanin5 permissions
Permissions
8/20/2019 Intro Linux Awk
26/51
Permissions‒ Where i the # come rom in the c)mod comman
Thin@ o the permission settin5s as a series o its :
"#$ "#$ "#$ % 111 111 111
"#& "#& "#& % 110 110 110
"#$ &&& &&& % 111 000 000
an so on)))
"#$ % 111 'n ('n)"* % 7
"#& % 110 'n ('n)"* % 6
"&$ % 101 'n ('n)"* % 5"&& % 100 'n ('n)"* % 4
&$$ % 011 'n ('n)"* % 3
&$& % 010 'n ('n)"* % 2
&&$ % 001 'n ('n)"* % 1
&&& % 000 'n ('n)"* % 0
8/20/2019 Intro Linux Awk
27/51
A DpipeE - passes output o one Linu( comman to the input o asecon comman
ExampleB ls Ac 'c < counts the numer o characters! .ors an linesE
8ot limite to %ust one pipe! can strin5 multiple pipes to5ether
D - reirection o iles
command &ilename < output o comman Dor pro5ramE is sent to a ilecalle &ilename instea o ein5 isplaye on the screen
ExampleB ls 0ile3list
command &ilename < the ile &ilename is the input to the comman orpro5ram
ExampleB xplor X ps&'inp
Pipes and Redirection
8/20/2019 Intro Linux Awk
28/51
Background Calculations
‒ For lon5 calculations onOt .ant the process irectly associate .iththe .ino. or shell Wino. must remain open an actie urin5 calculation
Wino. is =loc@e> until the pro5ram is inishe
Calculations .ill e stoppe i the .ino. is close
A intense calculation can oer.helm the shell enironment! leain5 to the.ino. crashin5 or een slo. o.n your computer
/utput isplays on .ino. can e lost! loc@ .ino. or crash computer
‒ nstea! sumit your =%o> to the =ac@5roun> Lo.ers the calculations priority to access the CP;
Any interactie calculation has the hi5hest priority ExampleB ac@5roun - (plor X ps)inp ps)out &&
interactie - (plor X ps)inp
‒ ;se ps comman to monitor status o ac@5roun %os
8/20/2019 Intro Linux Awk
29/51
vi – Primitive Text Editor
‒ /pens any te(t ase ile or reain5! eitin5 an .ritin5 /nly simple te(t or ASC iles can e eite .ith i
ou .ill see 5ierish .ith Y)oc! Y)p! etc)
‒ Li@e Linu(! i uses a numer o simple comman line unctions
A numer o the unctions reGuire a @ey comination Dctrl @ey H another@eyE
For a Complete List o Ri Commans an '(planations see =The Ri Loers $ome Pa5e> http:66thomer)com6i6i)html
/r =Learnin5 the i 'itor> y L) Lam! /O"eilly & Associates! nc
‒ i &ilename &ilename e(ists! i .ill open the ile or eitin5
&ilename oesnOt e(ist! i .ill create the ile or eitin5
8/20/2019 Intro Linux Awk
30/51
vi – Primitive Text Editor
'itin5 MoeLine numer Column numer
Cursor Location
Cursor
What part o the te(t is sho.n: AllTopot
Percenta5e
8/20/2019 Intro Linux Awk
31/51
‒ "or>in2 it) .iles
BF < Guits only i no chan5es to the ile hae een mae BF&
8/20/2019 Intro Linux Awk
32/51
‒ !ddin2 to a .ile
Enter %ey < as a lan@ line at the cursor position Esc >ey < e(its or leaes the actie i unction
i or a < enters insert moe! allo.s te(t to e type into the ile at thelocation o the cursor
R < enters replace moe! allo.s te(t to e type into the ile at the locationo the cursor replacin5 any e(istin5 te(t
‒ +eletin2 dd < eletes the line at the position o the cursor
d < eletes the .or at the position o the cursor
x < eletes the character uner the cursor
r < replace the character uner the cursor + < eletes rom the cursor position to the en o the line
u < uno the last eit or chan5e
U < uno all the eits on a sin5le line
Place a numer in ront o comman an the comman .ill e e(ecute thatmany times
vi – Primitive Text Editor
8/20/2019 Intro Linux Awk
33/51
vi – Primitive Text Editor
‒ Copyin2 and Pastin2 Text
number yy < yan@s DcopyE the speciie numer o lines Dstartin5 at thecursorE
p < put DpastesE the preiously yan@e DcopieE lines in the te(t ater the
cursor G < %oins t.o lines at the position o the cursor
‒
8/20/2019 Intro Linux Awk
34/51
!k/"a!k – Primitive #butPowerful$ Programing language
‒ Interpreted 'not compiled* lan2ua2e
C-li@e
A ile containin5 the sot.are coe nees to e passe to !>
- a>script,a> ; the !> pro5ram
- in0ilename 4 the ile use y the !> pro5ram
- out0ilename < the output 5enerate y the !> pro5ram
‒ !> si2ni.icantly simpli.ies ritin2 a Fuic> pro2ram Automatically hanles openin5 an reain5 iles an inputin5 ata into
stanar ariales
Structure to rea a ile compose o ro.s an columns
IMPORT!NT < seGuentially reas each ro. as it e(ecutes the pro5ram
50 16 ro-s t"e program gets executed 16 times 4 ma8or source o0 con0usion
a> ;. a>script,a> in0ilename out0ilename
k P -t t
8/20/2019 Intro Linux Awk
35/51
BE%I"
E"
&
logic statements #i'( and(
or( not$arit)meticloopingta*le arra+sprinting
I"PU T
,UTPU T
!k Program -tructure
8/20/2019 Intro Linux Awk
36/51
All o the commans in thesection eine y '8 occurs 'F/"' the ile isrea
All o the commans in thesection eine y '8, occurs AFT'" the ile is rea
To comment out a line o te(trom a script a =Z> eorete(t
- Line is s@ippe y !>
. T)is script politel+introduces itsel' BE%I" print 01ello( !orld2
3
.4ain – &oes "ot)ing( *ut stillreads 5le
3
E"& print 0B+e( !orld2
3
BEGIN/E
ND
8/20/2019 Intro Linux Awk
37/51
The '8 section is commonlyuse to set or eine the alueo ariales use y the MA8
pro5ram
Also! to open an input ata orinormation rom other iles
The '8, section is commonlyuse to print out the results othe A.@ Pro5ram
BE%I" Cmax6789 :;
8/20/2019 Intro Linux Awk
38/51
The arious unctions o AW? perorms the tas@s you .ant as the
pro5ram seGuentially reas the input ile
MAIN
PkID NH N15 CA CB CAi CBi COi
=77 K=@< >;=< =77 K=7 >;=;K @=K7 =K> ?@=7@ ?=K?@=77 K=@ >;=;A ;7=@ @A= =< =7 ?=A? =KKA=77 A=< >?
8/20/2019 Intro Linux Awk
39/51
MAIN
T)e primar+ !k 'unctions can *egrouped into < categories
< Logic statements < rit)metic
< Looping
< rra+s < Printing
8/20/2019 Intro Linux Awk
40/51
MAINBE%I"
Cmax6789 :;
As the ile is ein5 rea in! youcan no. .rite instructions totest! chan5e or manipulate the
ori5inal ata
ou can eine your o.nariale names
ou can o any numer oarithmetic unctions D < asic math H!-!Y!6![
< eneral unctions < cosD(E! e(pD(E!sGrtD(E! etc)
8/20/2019 Intro Linux Awk
41/51
Lo5ic statements < i. Dlo5ical test o a parameter6arialeE
< Proaly most important lo5ic comman < eneral call structure is
i. 'statement to test * JactionK
'(ample: i DV1 II =$APP>E < "eas =i column 1 eGuals $APP> < this is true then .e o somethin5
< else‒ ;se to perorm an action .hen the i statement is alse‒ else \action]
‒ '(ample
'8 \V1 I =$APP>i DV1 II =$APP>E print = am $APP>else print = am SA,>
3
Functions
8/20/2019 Intro Linux Awk
42/51
Lo5ic statements < & 'not* true i not a match
'(ample: i DV1 QI=$APP>E
True i V1 8/T 'N;AL to =$APP>
< 'and* true only i oth conitions are met '(ample: i DV1 V && V1 V3E
True i V1 is lar5er than /T$ V an V3
< AA 'or* true i one o multiple conitions are met '(ample: i DV1 V ^^ V1 V3E
V1 only nees to e lar5er than either V or V3 or the statementto e true
Functions
BE%I"
8/20/2019 Intro Linux Awk
43/51
Functions
Loops < allo.s you to repeat aset o instructions until aconition is met
Ma%or source o prolem <ininite loop
< The e(it conition is neer met
T.o loop unctions
< For
< WhileE"&
or #i 9 J i 9 "RJiHH$
print C6i8(CB6i83
3
BE%I" D)ile getline re'=pck
F 7$ Cre'6i8 9 GCBre'6i8 9 G>iHH
3
or #i 9 J i 9 "J iHH$ i' #Gi F9
8/20/2019 Intro Linux Awk
44/51
Functions
!rrays < allo.s you to assi5nmultiple alues to a sin5leariale
'ectiely allo.s you to sort or5roup inormation
T.o types o Arrays
< 1,: CA0
< ,: C0!0
BE%I" i9
PkI&6i89G"16i89G>"
8/20/2019 Intro Linux Awk
45/51
Functions
print. < primary mechanism oreportin5 the results o the !>pro5ram to the user
'(tremely le(ile numer ooptions aailale to ormat output
< Can o calculations .ithin printstatement
< Can e rustratin5 to 5et it ri5ht)
T.o types o print statements
< print: no ormattin5! %ust prints thealue o the aluale
< print : ull ran5e o ormats
aailale
BE%I" state901PPO2
3
or #i 9 J i 9 7JiHH$
print iprint iiprint' #0Qsn2(
state$3
8/20/2019 Intro Linux Awk
46/51
Functions
‒ '(amples o ierent ormattin5 options .ith print 'ach ariale nees a type einition:
J - ecimal
Js - strin5
J < loatin5 point
Je < loatin5 point .ith scientiic notation
Formattin5 is =literal>
print. '9HsHsn:D @1D@5*
< print all the characters in column 1 DJsE an column DJsE < n print ne. line
< no spacin5
_ V1 I $APP an V I SA, the output .oul e $APPSA,
8/20/2019 Intro Linux Awk
47/51
Functions
‒ '(amples o ierent ormattin5 options .ith print
Spacin5 ! Tas an %ustiications The numer o spaces et.een type einitions .ill e printe
t < Ta! usin5 system eine ta locations
n < print ne. line
Can use any numer or comination o tas! spaces an ne. lines
,eault printin5 is ri5ht %ustiie For let %ustiication! place a ; in ront o the type classiication De'g' J-10sE
print. '9Hs Hsn:D @1D@5*
< sin5le space
_ V1 I $APP an V I SA, the output .oul e $APP SA,
print. '9Hs tHsnn:D @1D@5*
< ie space then ta
_ V1 I $APP an V I SA, the output .oul e $APP SA,
_ Follo.e y t.o ne. lines
8/20/2019 Intro Linux Awk
48/51
Functions
‒ '(amples o ierent ormattin5 options .ith print
Precision Moiier =Fine tunes> ho. the ariale is printe
-e&ines both spacing and number o& characters or signi&icant &igures printed
Simply! place a numer in ront o the type classiication De)5) J)3E
print. '9H17sHsn:D @1D@5* < 10 spaces or the irst strin5 an spaces or secon strin5
< Spaces inclue the numer o characters in the strin5
_ V1 I $APP an V I SA, the output .oul e $APP SA,
_ spaces in ront o $APP D spaces H characters in $APP I 10E
_ spaces in ront o SA, D spaces H 3 characters in SA, I E
_ /" printin5 o V1 .ill en on column 10 an printin5 o V .ill en on column 1
print. '9H. H,/.n:D @1D@1*_ V1 I 163! the output .oul e 0)333333 0)333
_ H. < all the characters are printe
_ in H,/ inicates a total o characters are printe Dincluin5 ecimal pointE
_ 3 in H,/ inicates a total o 3 characters are printe to the let o ecimal point
8/20/2019 Intro Linux Awk
49/51
Functions
‒ '(amples o ierent ormattin5 options .ith print Printin5 is =literal>
Anythin5 .ithin the Guotes is printe
print. '9Hs $ELLO Hsn:D @1D@5*
_ V1 I $APP an V I SA, the output .oul e $APP $'LL/ SA,
print. '9$ello "orldn:*_ ,onOt nee to print a ariale
_ The output .oul simply e: $ello Worl
Print to a File Simply reirect the output o the print or print statement to a ile name
print. '9$ello "orldn:* )elloorld,txt
8/20/2019 Intro Linux Awk
50/51
Functions
‒ '(amples o ierent ormattin5 options .ith print Can o Math .ithin the print an print statement
print. '9Hd Hdn:D @15DsFrt'@5**_ V1 I 163! the output .oul e 0)111111 0)##
This is a 5eneral eature o !>D unctions can e imee .ithin otherunctions
For More inormation on A.@! see
The oo@ =se an a.@> y ,ale ,ou5herty /O"eilly an Associates
The 8; A.@ ;sers uie:)ttpS//!!!=gnu=org/so't!are/ga!k/manual/ga!k=)tml
'ectie A.@ Pro5rammin5: )ttpS//!!!=gnu=org/so't!are/ga!k/manual/
Li N D i l
8/20/2019 Intro Linux Awk
51/51
Linux N D – inal T)oug)ts
These Lectures hae only meant to sere as a 5eneral introuctionto oth Linu( an A.@
There is a lot more etail an other topics that simply .ere notcoere) 'ntire courses are eicate to these topics) i notpresent eerythin5 there is to @no. aout Linu( an A.@ orpro5rammin5 in 5eneral
Masterin5 an operatin5 system an computer pro5rammin5 .ill onlycome rom e(tensie eort an practice
The est .ay to learn is y oin5QQ