DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 5th June 2020
victorvas's Avatar
victorvas victorvas is offline
Real Name: Victor
Fdisk Soldier
 
Join Date: May 2019
Posts: 68
Question Period (.) in ed

Hello!
I'm trying to make ed script and save it into a file commands.ed:
Code:
5
i
text
text
.
w
q
How do I insert a single period(.) on a line like this
Code:
.
Whenever I press .<Enter>, the ed exits text insertion mode.
Reply With Quote
  #2   (View Single Post)  
Old 5th June 2020
Head_on_a_Stick's Avatar
Head_on_a_Stick Head_on_a_Stick is offline
Real Name: Matthew
Bloaty McBloatFace
 
Join Date: Dec 2015
Location: London
Posts: 171
Default

Add a blank line then substitute it with a dot.

See also https://stackoverflow.com/questions/...e-period-in-ed
__________________
Linux is for people who hate Windows. BSD is for people who love UNIX.
Reply With Quote
  #3   (View Single Post)  
Old 5th June 2020
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,596
Default

It is rather simple to do in sed(1):
Code:
j65@ml310e ~ $ cat test.txt
1
2
3
4
5

j65@ml310e ~ $ sed -e '3aThis is after line nr three' test.txt
1
2
3
This is after line nr three
4
5
Please keep in mind that this doesn't modify the file. For that you will have to use the "-i" option.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
Reply

Tags
ed, period

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PF: limit number of incoming connectios during some time period Lexus45 OpenBSD Security 2 8th November 2017 01:15 PM
How to turn drives off after a period of time? drhowarddrfine FreeBSD General 9 3rd May 2009 12:05 PM


All times are GMT. The time now is 08:09 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick