Shell messy notes

Source: Internet
Author: User

Shell clutter Note 1. awk usage Java code awk-F "|" '{if ($6 = "1-14-6-A" | $6 = "1-14-6-AB "| $6 =" 1-14-6-B "| $6 =" 1-14-6-BB "| $6 =" 1-14-6-C "| $6 =" 1-14-6 -CB "| $6 = '1-14-6-D '| $6 = '1-14-6-DB ') print $5} 'DW. stat.2013-05 *>/home/IM20-GROUP/xinchun. wang/data.txt-F: Change the separator >>: output the file to the file Terminal 2. count the number of times a word appears. Java code cat. log | grep "noEduExp" | wc-l wc: count the number of occurrences. 3. Search for the nth field in the file and output the first 10 records. Split by "", output $3 data, sort the data, calculate the count, sort the data, and then calculate the first 10 rows of records. Java code cat mydata. log | awk-F "" '{print $3}' | sort-rn | uniq-c | sort-rn | head-10 4. Search for all keywords in a directory. Java code grep-lR 'script './

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.