Sponsored Content
Top Forums Shell Programming and Scripting New to SSH and looking for short talk Post 302956165 by Don Cragun on Sunday 27th of September 2015 08:14:22 PM
Old 09-27-2015
Quote:
Originally Posted by grep for days
Fantastic. I had it a bit mixed up so this is a much better explanation. How about this one?

Code:
sed -i.bak "13iwww       IN     CNAME    lantstic.com."  /var/named/lantstic.com.db


sed - live stream editor. Can replace multiple occurrences of text simultaneously.

-i - in-place argument. When combined with sed it replaces text and overwrites the original.

-i.bak - when using the extension .bak at the end of -i this allows you to keep a copy of the old file under that extension.

13iwww - specifies the 13th line on where to insert the sed replacement

IN - declares you are replacing

CNAME -

Lanstic.com. - in the quoted text it is the text being searched and replaced





This command uses the “sed” stream editor to replace a line of text with another. In this case it is looking for the 13th line in a file and replacing the CNAME of it wit lantstic.com. It should first create the backup (-i.bak) to /var/named/lanstic.com.db.tmp and if it is successful will mv (move) the old var/named/lanstic.com.db.tmp and replace it with the new var/named/lanstic.com.db
As I suggested before, PLEASE stop trying to guess what these commands do and type them into your keyboard and see how they behave instead. Then, if you don't understand what happened, open up a new thread with the command that isn't working the way you think it should. Trying to keep track of multiple questions in a single thread confuses people who are trying to help you.

For the case above, the sed editing command is 13i (not 13iwww) and it tells sed to insert text before line 13. With a GNU sed on a Linux system, the text to be inserted will be:
Code:
www       IN     CNAME    lantstic.com.

And, the file being edited is /var/named/lanstic.com.db. Do note that the pathnames with and without the leading slash character are very different unless you are sitting in your system's root directory when you invoke that sed command.
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Talk utility

Are "talk" sessions logged or can they be logged? (1 Reply)
Discussion started by: pbonilla
1 Replies

2. UNIX for Advanced & Expert Users

apple talk

Does anyone know how to route apple talk through a bridged connection ? :eek: (1 Reply)
Discussion started by: maxamaynard
1 Replies

3. UNIX for Dummies Questions & Answers

Talk not working

Hi, I am trying talk but it isn't working. I tried talk ip terminal talk ip:terminal First it says: Then after 2 seconds I have checked the mesg status: Its y I am not getting any invitation on the other machine. Thanks in Advance (1 Reply)
Discussion started by: vibhor_agarwali
1 Replies

4. IP Networking

UNIX talk

I have the manpage for this utility on my system, but the utility itself is not there. My friend has the utility, but it does not work, not even on the same machine. Does anyone remember it? What software package is it related to? Where is it configured? (1 Reply)
Discussion started by: Corona688
1 Replies

5. Shell Programming and Scripting

talk command to chat

Hi, Could you please advice on the following query: There are 2 users on a unix box: 1. aaaa 2. bbbb I open 2 putty sessions and login with the above 2 users. Then I type the following using the aaaa user to chat with bbbb. talk bbbb or talk bbbb@hostname Result: the screen goes... (1 Reply)
Discussion started by: miltonkeynesguy
1 Replies

6. Shell Programming and Scripting

problems with using talk command

using talk option i tried to send message to my team mate. for connecting to one unix box, we are having a common userid and password except that, the ip addresses will change for me it is x.x.x.4, for my colleague it is x.x.x.3 These are the steps i did > who <userid> pts/2 ... (1 Reply)
Discussion started by: trichyselva
1 Replies

7. What is on Your Mind?

Anybody want to talk about Krack?

At face value this looks bad for Android 6 and Linux. Wi-fi security flaw 'puts devices at risk of hacks' - BBC News (1 Reply)
Discussion started by: hicksd8
1 Replies

8. Programming

Bridging Talk

Hi! I would like to start creating a bridge for good old Unix talk program. This bridge would allow you to joinIRC-channel by using talk just for example. I have a couple of questions: 1. Are there any previous attempts or implementations creating Talk bridge? 2. Which version of the talk... (9 Replies)
Discussion started by: homebeach
9 Replies
LEARN(1)						      General Commands Manual							  LEARN(1)

NAME
learn - computer aided instruction about UNIX SYNOPSIS
learn [ -directory ] [ subject [ lesson ] ] DESCRIPTION
Learn gives Computer Aided Instruction courses and practice in the use of UNIX, the C Shell, and the Berkeley text editors. To get started simply type learn. If you had used learn before and left your last session without completing a subject, the program will use information in $HOME/.learnrc to start you up in the same place you left off. Your first time through, learn will ask questions to find out what you want to do. Some questions may be bypassed by naming a subject, and more yet by naming a lesson. You may enter the lesson as a number that learn gave you in a previous session. If you do not know the lesson number, you may enter the lesson as a word, and learn will look for the first lesson containing it. If the lesson is `-', learn prompts for each lesson; this is useful for debugging. The subject's presently handled are files editor vi morefiles macros eqn C There are a few special commands. The command `bye' terminates a learn session and `where' tells you of your progress, with `where m' telling you more. The command `again' re-displays the text of the lesson and `again lesson' lets you review lesson. There is no way for learn to tell you the answers it expects in English, however, the command `hint' prints the last part of the lesson script used to evaluate a response, while `hint m' prints the whole lesson script. This is useful for debugging lessons and might possibly give you an idea about what it expects. The -directory option allows one to exercise a script in a nonstandard place. FILES
/usr/share/learn subtree for all dependent directories and files /usr/tmp/pl* playpen directories $HOME/.learnrc startup information SEE ALSO
csh(1), ex(1) B. W. Kernighan and M. E. Lesk, LEARN - Computer-Aided Instruction on UNIX BUGS
The main strength of learn, that it asks the student to use the real UNIX, also makes possible baffling mistakes. It is helpful, espe- cially for nonprogrammers, to have a UNIX initiate near at hand during the first sessions. Occasionally lessons are incorrect, sometimes because the local version of a command operates in a non-standard way. Occasionally a lesson script does not recognize all the different correct responses, in which case the `hint' command may be useful. Such lessons may be skipped with the `skip' command, but it takes some sophistication to recognize the situation. To find a lesson given as a word, learn does a simple fgrep(1) through the lessons. It is unclear whether this sort of subject indexing is better than none. Spawning a new shell is required for each of many user and internal functions. The `vi' lessons are provided separately from the others. To use them see your system administrator. 7th Edition October 22, 1996 LEARN(1)
All times are GMT -4. The time now is 09:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy