"Linux" character conversion command expand

Source: Internet
Author: User

The command is to turn the [tab] key into the SPACEBAR:

[Email protected] ~]# expand [-T]fileoptions and Parameters:-T: Numbers can be followed. In general, a TAB key can be used8a space bar to replace the key. We can also define by ourselves how many characters a [tab] key represents! Example one: to/etc/Mans. config expert first for MANPATH, take the first three lines; [Email protected]~]#grep '^manpath'/etc/Mans. config |Head-N3MANPATH/usr/MansMANPATH/usr/share/MansMANPATH/usr/local/Mans# The symbol at the beginning of the line is^, we'll leave it to the next section! First, the concept can be! Example two: If I want to list all the symbols? (WithCat) [[email protected]~]#grep '^manpath'/etc/Mans. config |Head-N3|Cat-Amanpath^i/usr/Mans$MANPATH^i/usr/share/Mans$MANPATH^i/usr/local/MansDid $# find the difference? Yes ~ [tab] button can beCat-a display becomes ^I example three: bearing, I will [tab] button configured to6characters in a word? [[Email protected]~]#grep '^manpath'/etc/Mans. config |Head-N3| > expand-t6- |Cat-Amanpath/usr/Mans$MANPATH/usr/share/Mans$MANPATH/usr/local/Mans$123456123456123456... # Take a closer look at the numbers above, because I'm6character to represent the length of a [tab], so, # man ... to the/usr will be isolated between A(two [tab]) characters Fu Yi! If tab is changed to9, it's a different story! Here is also not good understanding ~ You can configure a few more numbers to check it! 

Expand is also very fun ~ He will automatically turn [tab] into the space bar ~ So, in the above example, the use of cat-a will not find the ^i word Fu Yi ~ In addition, because [tab] The biggest function is the format neatly arranged! We turn into the space bar, the space bar will also be based on our own definition to add size ~ So, not a ^i will be replaced by 8 blank Oh! Pay special attention to this place! In addition, you can also refer to unexpand this blank to [tab] Command function Ah! ^_^

  Reference:Http://vbird.dic.ksu.edu.tw/linux_basic/0320bash.php#expand

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.