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!
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 had opened a file in vim editor in my ubuntu 8.04 & wanted to see if line ends with \r\n (like DOS) or \r (in UNIX)
& vi editor got hung with processor nearing 50%
Then I pressed ctrl+c & vim resumed with message
147416605 matches on 1 line
So my question is
(1)why this reaction from vim ?
(2)I want to see al control characters in file . What should i do ?
I used notepad++ in windows & it had option to differentiate tabs,spaces,return etc.
Looking at your idea of "searching" .. you are applying a "replace" command and replace a line ending metacharacter with nothing. AFAIK, the replace command in vim will not change multiple lines into one, so this replacement is just without effect. You probably created an infinite loop, because it matches ALL THE TIME on the first line, not doing anything and starting again.
To just search (not replace), use the '/' command instead of ':s'.
For your question (2) -- no idea, never needed that
'n' flag means no replacement just count matches
No it does not!!
From the OReilly Sed&AWK book (only the relevant part):
The following flags can be specified:
n Replace nth instance of /pattern/ on each addressed line. n is any number in the range 1 to 512, and the default is 1.
Normally a end-of-line character (\n, \n\r etc) only occurs once in a line (at the very end). Looking for it globally (the g switch) in that line is generally not needed.
BTW: if you only want to see if a certain string exists, why not use: /<string> ?