Friday, 11 May 2012

More Linux geekiness ...

Following on from my earlier post, I had a requirement to delete a bunch of lines from a file using everyone's favourite editor - vi - today.

Now I've known for a long while that DD gets rid of a single line, but I had about fifty to remove, and my fingers were getting tired ....

Thanks to my colleague, Richard, I know now that I can simply type: -

10dd 

to delete ten lines, or: -

20dd 

to delete twenty lines.

You get the picture .....

Still, I do miss the IBM mainframe-style editors, that give one an action column on the left-hand side, from where one can type I10 to insert 10 lines, D20 to delete 20 lines etc.

Ce'st la vie.

Whilst I'm on the subject, did you know that you can simply enter the command time in front of any command to get an idea of how long it takes to complete ?

I didn't but I do now.

Here's an example: -

$ time ls ~/Desktop/Docs/SWG/Lotus/Lotus\ Notes/
8.0.1
8.5.1
Citrix
Demos
Evangelist
How Tos
Lotus Notes vs Microsoft Outlook.pdf
Notes Connectivity on Mac OSX.odp
Notes Connectivity on Mac OSX.pdf
Notes852V1 Mail Template NTF.zip
Presentations
Themes
Traveler853_for_OpenMic_24April2012_FINAL.pdf
USB Key.txt
Widgets
enh r8.5.2 v1 m1.0.zip
ibmml85.ntf

real 0m0.003s
user 0m0.001s
sys 0m0.002s


No comments: