Contents /
Previous /
Next
Slicing Lines of Files into Fields
cut: Remove sections from each line of files.
cut [OPTION]... [FILE]...
Options:
-d, --delimiter=DELIM : use DELIM instead of TAB for field delimiter
-f, --fields=LIST : output only these fields
Examples:
> more /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/bin/bash
daemon:x:2:2:Daemon:/sbin:/bin/bash
felix:x:500:100:Felix Gers:/home/felix:/bin/bash
guest:x:502:100:guest guest:/home/guest:/bin/bash
>cut -f1 -d':' /etc/passwd
root
bin
daemon
felix
guest
awk: Interpreter for the programming language call AWK.
The common use for awk is also in field stripping.
For that awk is slightly more flexible than cut.