delimiters and field lists:
delimiters and field lists allow you to chunk out lines separated by characters for instance:head -n 1 etc/passwd/ |cut -d ':' -f 1
outputs:
root
as you can see -d is the delimiter and -f is the field list. here the character they are separated by is ':' and the section they are showing is 1. you can even use -s to bypass lines that dont contain field delimiters
charicters:
characters are the simplest way to use cut. it just outputs the characters in a range. for example:head -n 1 etc/passwd/ |cut -c 2-4
outputs:
oot
as you can see -c is the character range.
No comments:
Post a Comment