Linux命令提取指定关键字后面(或前面)字段----cut命令

1.提取等号前面字段

echo "name=usr" | cut -d '=' -f 1

2.提取等号后面字段

echo "name=usr" | cut -d '=' -f 2


注备:

# cut --help

BusyBox v1.26.2 (2018-05-23 10:28:21 HKT) multi-call binary.


Usage: cut [OPTIONS] [FILE]...


Print selected fields from each input FILE to stdout


        -b LIST Output only bytes from LIST
        -c LIST Output only characters from LIST
        -d CHAR Use CHAR instead of tab as the field delimiter
        -s      Output only the lines containing delimiter
        -f N    Print only these fields
        -n      Ignored
#

猜你喜欢

转载自blog.csdn.net/ivansuntech/article/details/80430990
今日推荐