Methods to use the rev command: 2-Minute Linux Suggestions

Hello, that is Sandra Henry-Stocker, creator of the “Unix as a Second Language” weblog on NetworkWorld.
On this Linux tip, we’re going to take a look at a command that reverses textual content – the rev (reverse) command. As odd as this command may first seem, there are occasions that it may be fairly helpful
First, let’s take a look at a quite simple rev command. This command takes that’s piped to it and reverses it character by character.
The rev command can even reverse traces from a textual content file. The 2 instructions on this line show the primary three traces within the states file after which reverse these traces.
Now let’s take a look at a command that might really be helpful. On this command we take away the state abbreviations from every line like these simply proven. We do that through the use of rev twice and utilizing lower to omit the primary 5 characters on every line whereas it’s reversed. In case you needed to do one thing like this for 111,000 traces of textual content, you’d in all probability love this trick.
Principally, what’s taking place right here is every line goes by way of modifications like this:
That’s your Linux tip for in the present day.
In case you have questions or want to counsel a subject, please add a remark beneath.
And don’t neglect to subscribe to the IDG Tech(discuss) channel on YouTube. In case you appreciated this video, please hit the like and share buttons. For extra Linux suggestions, remember to observe us on Fb, YouTube and NetworkWorld.com.

Supply

Germany Devoted Server

Leave a Reply