Week08 - ULI101 Week 08 Week Overview Simple filter...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
ULI101 Week 08
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Week Overview Simple filter commands: head, tail, cut, sort, diff, tr, wc grep utility stdin, stdout, stderr Redirection and piping /dev/null file Advanced command line features
Background image of page 2
head and tail commands These commands display the beginning or the end of a file respectively By default, 10 lines are displayed The entire file will be displayed if it is less than 10 lines in length Example usage: head [-line_count] file head [-line_count] file for example: for example: head –3 users.log head –3 users.log
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
cut Selects fields or columns from files or standard input Range can be specified in multiple ways: 1–10 – first 10 3–8 – 3 rd to 8 th –10 – up to 10 th 2– – from 2 nd until the end of line 1–3,4,10– – combination of above Important options: -c – cut c haracters Example: cut -c 1-2 – will cut first 2 characters -f – cut f ields Example: cut –f 2,5 – will cut 2 nd and 5 th field
Background image of page 4
cut fields Default field delimiter is the tab Other field delimiter can be specified using the –d option For example: cut –d, –f1–2 – will cut first 2 fields delimited with a comma Field delimiter must be a single character, only one delimiter is supported If special characters are used for delimiters they must be quoted For example: cut –d” “ –f1 – space is the field delimiter
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
sort command Sorts single files or standard input Merges and sorts multiple files Is able to sort by fields Popular options: -f – ignore case in comparisons -n – numeric sort -u – display unique entries -r – reverse sort
Background image of page 6
diff command Finds differences between files Reports lines that are different Useful for comparing scripts (versions) Usage: diff [-w] file1 file2 -w option suppresses whitespace comparison diff3 utility compares 3 files comm utility can be used find common lines in 2 sorted files – opposite action do diff
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 26

Week08 - ULI101 Week 08 Week Overview Simple filter...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online