Linux Basics-word processing command rollup

Source: Internet
Author: User
Tags sort

This article summarizes the following commands:

Wc:word Count

-L: Shows only the number of rows

-W: Show Only words

-c: Show byte size only

Cut: (remove sections from every line of files) deletes a fixed portion of each row of the file, used to match the separator, and then filters the desired column contents

-D: Specify separator

-F: Specify the fields to display

M: Column M

M,n: Subsections m and N columns

M-n: M to nth column

Sort sorting

-F: Ignore character case

-T: Specify separator

-K: Specifies the location number of the separator

-N: Sorting by numeric size

-U: Sort after to heavy

Uniq:(report or omit repeated lines) reports or ignores duplicate rows, easy to ignore-C, can count repeat times

Practice:

1. Display the shell of each user on the current system;

# cut-d:-f1,7/etc/passwd

2. Display all kinds of shell used by all users on the current system;

# cut-d:-f7/etc/passwd | Sort | Uniq

3. Remove the 7th line of the/etc/inittab document;

# Head-n 7/etc/inittab | Tail-n 1

4, remove the user name of the 7th user in the/etc/passwd file;

# Head-n 7/ETC/PASSWD | Tail-n 1 | Cut-d:-f1

5. The number of files that start with the case of P-/etc in the statistics directory;

# ls-d/etc/[pp]* | Wc-l

Note : More wonderful tutorials Please pay attention to the triple computer tutorial section, triple Computer office group: 189034526 welcome you to join

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.