16 Basic Linux commands for text manipulation (save this)π§΅β
Hello linux folks, Today I'll be doing a quick, easy-to-follow thread on basic Linux text manipulation commands.
6. Headπ§
This command displays the first part of a file. Let's say we have a very long file and you only want to see the first couple of lines.
This command displays the first part of a file. Let's say we have a very long file and you only want to see the first couple of lines.
The sort command also has the capability of sorting in reverse order by using it's -r option.
Finally on the sort command, you can also remove repeated lines to get only unique lines. This is achieved by using the -u option of the sort command.
Here we traslated - to spaces. Here is another quick example for deleting characters with tr command.
The preceding example is simply equivalent to the'sort -u' command; it is up to you to choose which one you prefer. As for me, I tend to use both, depending on which comes to mind first.
Grep has a lot of useful switches that I won't go over here, but if you want to learn more about this handy utility, check out the grep man pages.
16. cut π§
The cut command can be used to remove/extract bytes, characters, and fields from files. Various parameters are used to specify what part or parts of the file are to be removed or displayed.
The cut command can be used to remove/extract bytes, characters, and fields from files. Various parameters are used to specify what part or parts of the file are to be removed or displayed.
That concludes today's thread! Thank you for reading!
If you enjoyed this thread and found it useful, please follow us (@linuxopsys) for more Linux, sysadmin, and devops content!.
Make sure to include some text manipulation commands; I'd love to know them as well.
If you enjoyed this thread and found it useful, please follow us (@linuxopsys) for more Linux, sysadmin, and devops content!.
Make sure to include some text manipulation commands; I'd love to know them as well.
Loading suggestions...