Linux - DesktopThis forum is for the discussion of all Linux Software used in a desktop context.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I'm trying to do some basic macros to format text. For example, I have a list of names and I want to put them in single quotes and comma separated. In my Windows and OS X editors I would just go to some Macros menu and Start Record, do the necessary keystrokes, Stop Record, then playback as needed. That's ideally what I would like to do in editors like gEdit,Kwrite,etc. Right now I'm having to bust out Vim and do something like, :map g i'<End>',<Del><Esc>l
Fine tuning a macro that way is a little more time consuming then I would like, especially for the more complicated macros. Any suggestions?
From your description, it sounds like using a regular expression in a substitute command would work out better.
You can precede the "s" command with the range to operate on--
"%s" operates on the entire file. "10,30s" works on lines 10-30. You can save parts of the line that match a pattern using storage registers.
:%s/\([A-Z][a-z]*\) \([A-Z][a-z]*\) /\2, \1/
This will take a list of names like
And convert it to
I'll play around with those gEdit plugins, thanks.
I'm sure regular expressions will do most of what I need, they are ver powerful after all. But I have yet to really wrap my head around them. I prefer the macro way because it only takes a few seconds to setup, where it can take me a good 20 minutes to hammer out a regular expression. But maybe this will be a good way to finally beat them into my head.
Emacs has easy macro record and playback. Don't be frightened of emacs. It's horribly powerful, but the easy stuff is still easy. It's window isn't as pretty as the newer GUI guys, but it's way more powerful and mature.
Thanks, I'll give that a try. I remember a few years ago bouncing between emacs and vim. I liked both for different reasons, but stuck with vim. Of course, this was on the shell. I've never really played with their X11 versions. So I'll give that a try.