VehiclesFashionRecipesBlogsHuntTravelsSportFunHandmadeITEducation
Mini-Games
x

x
zakruti.com » IT - Software » IT, programs, coding
Two Powerful Command Line Utilities 'cut' And 'tr' DistroTube

Two Powerful Command Line Utilities 'cut' And 'tr' DistroTube

FBTwitterReddit

video description

Rating: 4.0; Vote: 1
Two Powerful Command Line Utilities 'cut' And 'tr' DistroTube Recently, I've made videos on command line utilities like 'awk' and 'sed'. In this video, I cover two powerful command line utilities'cut' and 'tr'. The 'cut' command removes sections from each line of a file. The 'tr' command translates or deletes characters from standard input. - https://linux.die.net/man/1/cut - https://linux.die.net/man/1/tr
Date: 2022-03-30

Comments and reviews: 7


really like this video but would like to note that sed would can pretty much do what tr did through basic regex knowledge for example you can replace lower case to upper case with this command:
-echo -This is a line of text- - sed 's/[a-z]/\U&/g'-
and upper to lower with this one:
-echo -This is a line of text- - sed 's/[A-Z]/\L&/g'-
you could also replicate the compliment function with the carrot symbol - inside square brackets like so:
-echo -this is some text and numbers 1234- - sed 's/[-0-9]//g'- (This means that anything that is not a digit replace it with empty string)
but of course using tr for these tasks would probably be a better idea

reply

That was a fairly good example of using AWK over cut(1) - the one with all the whitespaces.
Fun fact: the following bit of PERL will do what you did with cut(1)'s --c- functionality:
perl -ne 'chomp(); printf(-%s\n-, substr($_, 0, 10))' -/.bashrc
And with AWK:
awk '-printf(-%s\n-, substr($0, 0, 10))-' -/.bashrc
AWK is actually a bit smarter here, because it knows to handle empty lines accordingly. AWK is a lot like PERL in its syntax and approach, at least with respect to PERL's -while- loop iterating over lines in a file.

reply

This series you are doing DT is awesome, especially if someone is interested in shell scripting. These techniques even though basic are quite powerful when complemented with the power of shell scripting. Please continue with this series. Thank You.
reply

Hi,
Why not -xdotools-? its quite useful for keyboard and mouse automation. I am excited for video on xdotools and creative ideas to use it for productivity. Hope DistroTube will bring videos on xdotools.
Thanks,

reply

I would have included -paste- in this video since it's basically the inverse utility of -cut-. I also think -paste- is a very useful and often overlooked utility.
reply

You should do something like a quick fire overview of utilities like shuf, tac, nl etc most people could use these but won't know about them!
reply

Not even finished viewing the video, and still say, -Nicely done! You neatly avoid the (usual) UUOC seen in many UNIX/Linux primers.-
reply
Add a review, comment






Other channel videos