LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 02-11-2012, 06:39 PM   #1
echipbk
LQ Newbie
 
Registered: Feb 2012
Posts: 13

Rep: Reputation: Disabled
Smile How ctrl-d works in ed editor ??


Normal steps to create a text file using ' ed ' :

$ ed
a
hello
.
w myfile
6
q


Then, I use ctrl-d to test how ed reacts to that command :

$ ed
a
hello
(*)
ctrl-d
ctrl-d
(*)
.
hello
w myfile1
6
q

After hitting enter down to the line (*), I entered ctrl-d twice. Then typed . to stop adding text, and hello appeared on the next line. I don't understand why ???

Another case is when I entered ctrl-d 6 times after getting to the line (*), then the ed process stopped without having to enter the sequence " . -> w -> q "
$ ed
a
hello
(*)
ctrl-d (press this ctrl-d 6 times)
(*)
?
$ (the prompt appears here)

Can anyone please help me to explain those 2 questions? Thanks a lot.
 
Old 02-12-2012, 01:42 AM   #2
hydraMax
Member
 
Registered: Jul 2010
Location: Skynet
Distribution: Debian + Emacs
Posts: 467
Blog Entries: 60

Rep: Reputation: 51
Another ed user? Well, that makes at least two of us.

Most of your question is answered by this: ed has no idea why you are sending it the end-of-transmission character. If you do it enough, ed eventually prints it's error symbol, the question mark. Which, in ed-speak, is roughly translated as, "What the heck is going on?!?" Send enough EOT characters and it will eventually guit.

In your first question, the '.' has nothing to do with ctrl-d, but simply designates the current line in the buffer (usually the last line you appended). Use the '.' as a command by itself (after you've finished appending material) and it will print said line.

BTW, ed does have a manual page...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Recognizing ctrl+c,ctrl+l,ctrl+d in C programs leonardo6023 Programming 1 08-19-2009 09:23 AM
how ctrl+c works to terminate a process rithik_ghoshal Linux - General 2 11-02-2008 08:01 AM
how does ctrl+c works with SIGINT in redhat linux saikasavar Linux - General 1 07-16-2007 04:09 AM
ctrl+alt+F? no longer works seanr Linux - Software 6 10-04-2005 05:31 PM
Turbo C and C++ works on Linux and if so which compiler and editor is available. benoy4007 Red Hat 2 08-14-2004 08:13 AM


All times are GMT -5. The time now is 06:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration