Linux Beginner Advanced file Management WC Uniq cut diff sort tr

Source: Internet
Author: User
Tags diff

WC calculates the number of lines , words , and bytes of a file

# wc/etc/passwd

1800/etc/passwd

# wc-l/ETC/PASSWD

40/etc/passwd

# wc-w/ETC/PASSWD

59/etc/passwd

# wc-c/ETC/PASSWD

1800/etc/passwd

grep Regular Introduction


^ Beginning of the line

$ End of line

V Take Back

n Display Line numbers

C Count Rows

         

diff compare two files to differences

d deleted (delete) -A added (append)-C changed (change )

CP/ETC/PASSWD PASSWD1

Delete a few lines and add a few lines to see the effect.

DIFF/ETC/PASSWD PASSWD1


Uniq to File Weight

Uniq-c file Displays the number of occurrences of duplicate rows in the file files count times

uniq-d file displays only duplicate rows, no duplicates are displayed


cut extracts files by column

- d indicates the column delimiter -F Select the output region -C to specify the character position

# cut-d:-F 1,7/etc/passwd |head-n 2

Root:/bin/bash

Bin:/sbin/nologin

# cut-c 1-3,6-9/etc/passwd |head-n 2


Substitution of tr characters for deletion

- d Delete

# tr-d: </etc/passwd |head-n 2

Replace

# TR ' ABC ' ABC ' </ETC/PASSWD |head-n 2

# TR ' abc ' A ' </etc/passwd |head-n 2

# tr ' A-Z ' A-Z ' </etc/passwd |head-n 2


sort sorted output

Sort By default in the order of the first character

- R Reverse order

-U Go Heavy

- n Sort by number

- t indicates that the delimiter is in conjunction with -K

- k Sort by specified field

# sort-t:-K 3/etc/passwd


Split split file split file named Xaa

-B (bytes) size

-L Number of rows



Linux Beginner Advanced file Management WC Uniq cut diff sort tr

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.