A string that handles a column of copy in Excel under Linux, removing the end of line space and adding special fields

Source: Internet
Author: User

Background: Copy a column of data from Excel to TXT, and then put it under Lunx, and find that each line ends with a fixed number of spaces, and I want to add a fixed field to the end of each line and separate the output with commas.

Cat Fastjason.txt | Awk-f/' {print $} ' | Sort | Uniq > Fast.log To remove a specific field; Cat Fast.log |xargs echo >fast.log Remove the indefinite number of spaces at the end of each line, all on one line, and each application separated by a space; Sed-i ' s//\n/g ' Fast.log , the space is transformed by a line character, and then at the end of each line. War, Sed-i ' s/$/&.war/g ' fast.log;cat fast.log |xargs echo output to one line, each application separated by spaces >sp.log;sed-i ' s// ,/g ' sp.log the space to a comma.

Cat Fastjason.txt | awk-f/' {print $} ' |sort |uniq|xargs echo >a.log
Sed ' s//\n/g ' A.log > B.log
Sed ' s/$/&.war/g ' b.log >c.log
Cat C.log |xargs Echo >d.log
Sed ' s/\n/,/g ' b.log > D.log

A string that handles a column of copy in Excel under Linux, removing the end of line space and adding special fields

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.