Shell Text Processing

Source: Internet
Author: User

1. Document Collation
Work number and name are recorded in the employee file
Employee.txt:
Jason Smith
John Doe
Sanjay Gupta
Ashok Sharma
Record work number and salary in bonus file
Bonus.txt:
100 $5,000
200
300 $3,000
400 $1,250
Requires merging two files and outputting the following
Processing results:
Ashok Sharma $1,250
Jason Smith $5,000
John Doe
Sanjay Gupta $3,000

# awk ' Argind==1{test[$1]=$0}argind==2{print test[$1],$2} 'Jason Smith $5,000200 John Doe $500300 Sanjay gupt A $3,000400 Ashok Sharma  $1,250, Jason Smith, John Doe, Sanjay Gupta400

(2) View the size of the swap partition

# free-m       Total used       free     shared    buffers     cachedmem:          1001        861        425-/+ buffers/cache:        338        663Swap:          509          0        509

(3) How long the root user landed today

Last Check all login information,

Lastlog View recent landing,

W or who view currently logged in user

(4) Print the port and process ID of the current sshd

# NETSTAT-ANP | grep sshd

(5) Print root can use the number of executable files

# echo "Root" s bins: $ (find./-type F | Xargs Ls-l | Sed '/-.. X/p ' | wc-l) "53

(6) Output the time it takes to create 20,000 directories natively

 for  Do mkdir neil$i donereal    0m2.086suser    0m0.180ssys 0m0.300s[[email    protected]:d IRS] Timereal    0m0.000suser    0m0.000ssys    0m0.000s

Shell Text Processing

Related Article

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.