Number of Linux output file columns, stitching files

Source: Internet
Author: User

If I just want to see the first few lines of the file, the number of fields per row (number of columns), my file is tab as a delimiter (this can be specified by itself), its specific command is as follows:

Head FileName | Awk-f'\ t'{print NF}'

If you want to consider stitching files by column, you can:

Paste-d'\ t' file1 file2

What if you want to stitch an empty field to the first line of a file? the steps are as follows:

First create an empty file, and then splice:

Touch file1paste-d ' \ t ' file1 file2

or directly

Paste-d ' \ t ' file1 file2 #file1 is not exist

Note that in the Windows and Linux Xixia, line breaks are not the same, Windows uses "\ r \ n", and Linux uses "\ n", so if it is the file interaction between the two systems, especially to the Windows files under Linux processing, delete the redundant "\ r".

Number of Linux output file columns, stitching files

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.