Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The above in Vim says to do it for every line from 1 to the end the rest of the line says to substitute the original pattern with the replacement pattern. The g at the end says to do it globally so it will do it for each occurrence.
I think that I would word that differently. Awk would be preferable for structured text files. Sed may be better for editing free form text. In either case, if the original pattern is split between a line, it may be better to use a sed script. You need to build lines in the pattern or hold space so that you can match a pattern containing the "\n" character. There is a book on Sed & Awk available on the web. ( It is the first edition that is available) The order of sed commands are important in a script and some possible input patterns can make the solution non-trivial.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.