Question Marks in ed


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Question Marks in ed
# 1  
Old 01-19-2005
Question Marks in ed

I typed the following commands:
Code:
176 lab2-37:~> ed newb.txt
74
1,6p
Hello
Hello World.
I need some sentences to edit.

add the script
OK Fn
2,4c
.
1,3p
Hello
add the script
OK Fn
q
?

Please note the second-to-last line: I want to quit the ed, so I typed q, but instead of quitting immediately, the ed gave me a question mark, why?
# 2  
Old 01-19-2005
You had not written the file. Another q will exit.
# 3  
Old 01-19-2005
Thanx. I know why now.
Code:
     If changes have been made in the buffer  since  the  last  w
     command  that wrote the entire buffer, ed will warn the user
     if an attempt is made to destroy the editor buffer via the e
     or q commands. The ed utility will write the string:

     "?\n"

     (followed by an explanatory message if help  mode  has  been
     enabled  via the H command) to standard output and will con-
     tinue  in  command  mode  with  the  current   line   number
     unchanged.  If the e or q command is repeated with no inter-
     vening command, it will take effect.

# 4  
Old 01-19-2005
I'm a little bit confused about ed. What's the use of ed since there are such more powerful editors like vim, emacs, etc.?
# 5  
Old 01-19-2005
ed is a really old editor, and beleive it or not, there are old systems like telephone switches that the only text editor available is ed. This is when I learned it and still use it.

Another use is when you have several things in a window you want to paste into a file, but don't want to lose it (by opening vi), you can use ed and accomplish this. Of course a second window will do the same thing.

Given the choice, most people will use vi (including me).
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replacing punctuation marks with the help of sed

#!/bin/bash a=(*.pdf) punct=((~`!@#$%^&*()_-+=|\{};':",./<>?)) for (( i =0; i < ${#a}; i++ )) do sed -ri 's/$punct//g' ${a} done I cannot use the above code, can you help me in removing all punctuation marks from file name except file extension. The idea is that once all... (9 Replies)
Discussion started by: ambijat
9 Replies

2. UNIX Desktop Questions & Answers

What is the way to get a total count of students and with highest marks from a file?

I have different things that I was trying to do but am kind of struggling with this since I'm a Linux noob. I have a files with student names ,marks,year school the . What is the most efficient way to get a total count of students and student with highest marks Initially I tried to get a count... (1 Reply)
Discussion started by: anil2103
1 Replies

3. Shell Programming and Scripting

after sed command file shows '????' question marks

Hi All, I am trying to replace a string in a oracle LDT file file extension .ldt. I am using the following command: sed "s/Test Number Viewer/Test Number 1/g" TEST_LIEN_FORM.ldt > TEST_LIEN_FORM.ldt.tmp mv TEST_LIEN_FORM.ldt.tmp TEST_LIEN_FORM.ldt But after the command, the file... (2 Replies)
Discussion started by: veena484
2 Replies

4. Shell Programming and Scripting

Count number of character occurence but not from quotation marks

I have the following string: 31-01-2012, 09:42:37;OK;94727132638;"Mozilla/5.0 (Linux; U; Android 2.2.1)";3G;WAP;I need a script which is counting the occurrence of semicolons ( ; ) but exclude the ones from the quotation marks. In the string given as example there are 8 semicolons but the script... (3 Replies)
Discussion started by: calinlicj
3 Replies

5. UNIX for Dummies Questions & Answers

Pine continuously marks old messages as unread

Hi, I have been having problem with pine for the past few weeks. I use email clinet Thunderbird to view my emails. Every time I open the thunderbird, all my emails were marked as unread. So, I logged into our email server to see what's wrong. even when I opened pine, all messages are labeled as... (0 Replies)
Discussion started by: veepine
0 Replies

6. Solaris

Question marks appearing instead of text entered

I have a netscape 4.79 browser for our GUI which connects to a Solaris5.8 box. During peek hours, we see question marks appearing in the screen instead of the text we enter. This results in query failure. This problem does not happen always, and is quite irritating because, we have to close the... (6 Replies)
Discussion started by: vanz
6 Replies

7. Shell Programming and Scripting

Process indicator with hash marks

Hi Experts, I have written a php script that calls several smaller bash shell scripts throughout it's loop process. Users run this script to achieve a task that this script has automated. However this script depending upon the amount of input variables could take some time to run. It may be a... (5 Replies)
Discussion started by: jaysunn
5 Replies

8. UNIX for Dummies Questions & Answers

Parsing name and phone as input and then print sub and marks out

I have a file like this : name phone id sub marks abc 2345 45 mat 90 bgt 6573 54 eng 89 ... .... .. ... .. ... .... .. ... .. Now i need to take in name and phone as input and then print sub and marks out, can u give me a sample code for this. P.S. If there are two of with same... (2 Replies)
Discussion started by: SasankaBITS
2 Replies

9. AIX

ShellScript displays un necessary question marks

Hi, This is suman. I am very new to Shell Scripting. I have a shell script, when I run that script, it is displaying un necessary question marks. But in the scritpt, there is no any " echo ? " statement. Can anybody please help me what could be the cause for displaying question marks ?? ... (3 Replies)
Discussion started by: clnsharma123
3 Replies

10. Shell Programming and Scripting

enclose a line with quotation marks

i have a file like this aaaa bbbb cccc aaa aaaa aa cccccccccccccccc aaaaaaa aaaa aaaa i want to enclose this lines with double quotation: "aaaa bbbb cccc" "aaa aaaa" "aa cccccccccccccccc" "aaaaaaa aaaa aaaa" any idea? (preferably without using sed) thanks in advance... (3 Replies)
Discussion started by: gfhgfnhhn
3 Replies
Login or Register to Ask a Question