Basic Linux commands for text manipulation ๐งโ
Hello Linux folks, Today I'll be doing a quick, easy-to-follow thread on basic Linux text manipulation commands.
[6] Head๐ง
This command shows the first section of a file. Assume we have a lengthy file and you only want to see the first few lines. This is where the head command comes in; the head command, by default, displays the first 10 lines of a file.
This command shows the first section of a file. Assume we have a lengthy file and you only want to see the first few lines. This is where the head command comes in; the head command, by default, displays the first 10 lines of a file.
Sorting by string numerical value is also possible with the sort command by using the -n option.
[10] Uniq (Unique)๐ง
Another useful tool for text manipulation is the uniq (unique) command. It is used to remove or omit duplicates from a file, hence the name unique.
Another useful tool for text manipulation is the uniq (unique) command. It is used to remove or omit duplicates from a file, hence the name unique.
The preceding example is simply the equivalent of the 'sort -u' command; you can choose which one you prefer. In my case, I use both depending on which I thought about first.
Grep has many useful switches that I won't go over here, but if you want to learn more about this useful utility, check out the grep man pages.
[15] vimdiff
Another excellent command for comparing files is vimdiff. Vim is launched on two to eight files using vimdiff. Each file has its own window.
Another excellent command for comparing files is vimdiff. Vim is launched on two to eight files using vimdiff. Each file has its own window.
[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.
And that's a wrap!
If you enjoyed this thread:
1. Follow me (@xtremepentest) & give this a RT!
2. Join 1000+ subscribers inside of my weekly newsletter "Linux Weekly Catch Ups" and never miss any Linux, security, and networking content.
getrevue.co
If you enjoyed this thread:
1. Follow me (@xtremepentest) & give this a RT!
2. Join 1000+ subscribers inside of my weekly newsletter "Linux Weekly Catch Ups" and never miss any Linux, security, and networking content.
getrevue.co
3. Join my discord server and hang out with 1000+ other members.
discord.com
discord.com
Loading suggestions...