“unexpand” Command Usage Example in Linux

Examples :

1. Basic Example

$ cat -vet file2
One     Two     Three   Four    Five    six     seven$
One     Two     Three   Four    Five    six     seven$
One     Two     Three   Four    Five    six     seven$
One     Two     Three   Four    Five    six     seven$
One     Two     Three   Four    Five    six     seven$
One     Two     Three   Four    Five    six     seven$
One     Two     Three   Four    Five    six     seven$
One     Two     Three   Four    Five    six     seven$

By using the “cat -vet” option against file1, we can see that the tabs are represented by the “I^” character.The “$” denotes a line feed.

$ unexpand -a file2 > file3
$ cat -vet file3
One^ITwo^IThree^IFour^IFive^Isix^Iseven$
One^ITwo^IThree^IFour^IFive^Isix^Iseven$
One^ITwo^IThree^IFour^IFive^Isix^Iseven$
One^ITwo^IThree^IFour^IFive^Isix^Iseven$
One^ITwo^IThree^IFour^IFive^Isix^Iseven$
One^ITwo^IThree^IFour^IFive^Isix^Iseven$
One^ITwo^IThree^IFour^IFive^Isix^Iseven$
One^ITwo^IThree^IFour^IFive^Isix^Iseven$

Hece the spaces are converted into tabs.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s