Sed & amp; Awk case 3 per day

Source: Internet
Author: User

Sed & Awk daily case 3 1. Delete only 2nd rows $ sed '2 d' employee.txt 2. Delete 1st ~ 4 rows $ sed '1, 4 d' employee.txt 3. Delete 2nd ~ The last line $ sed '2, $ d' employee.txt 4. deletes a row $ sed '1 ~ from the first line ~ 2 d 'employee.txt 5. Delete the row $ sed containing the manager '/Manager/d' employee.txt 6. Delete the row from the first row containing Jason to the first row $ sed'/Jason /, 4 d 'employee.txt 7. Delete the row containing the source code from the source code to the last code $ sed '/AJ /, $ d 'employee.txt 8. Delete the line between the source and the target /, /Jane/d 'employee.txt 9. Delete the row containing Jason and the second row $ sed '/Jason /, + 2 d 'employee.txt 10. Delete empty rows sed '/^ $/d 'employee.txt 11. Delete # Start comment row sed'/^ #/d' employee.txt

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.