Sponsored Content
Top Forums Shell Programming and Scripting Using sed to replace strings if NOT found Post 302637071 by lamoul on Tuesday 8th of May 2012 10:04:22 AM
Old 05-08-2012
1)input that i have: 127.127.1.0
input that iwant: #127.127.1.0 (only if exist)

2) input that i have: fudge 127.127.1.0 stratum 10
output that i want: #fudge 127.127.1.0 stratum 10

3) the string that iwant to add if NOT exist: server 192.168.122.76

this is the file that need to be upadated /etc/ntp.conf

Many thanks,
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace Strings with sed or awk

Hello i need some help with the usage of sed. Situation : 2 textfiles, file.in , file.out In the first textfile which is called file.in are the words for the substitution. Every word is in a new-line like : Firstsub Secondsub Thridsub ... In the second textflie wich is called file.out is... (5 Replies)
Discussion started by: Kingbruce
5 Replies

2. Shell Programming and Scripting

replace two character strings by two variables with sed command

Hello, I want to writte a script that replace two character strings by two variables with the command sed butmy solution doesn't work. I'm written this: sed "s/TTFactivevent/$TTFav/g && s/switchSLL/$SLL/g" templatefile. I want to replace TTFactivevent by the variable $TTFav, that is a... (4 Replies)
Discussion started by: POPO10
4 Replies

3. Shell Programming and Scripting

Help with sed search&replace between two strings

Hi, i read couple of threads here on forum, and googled about what bugs me, yet i still can't find solution. Problem is below. I need to change this string (with sed if it is possible): This is message text that is being quoted to look like this: This is message text that is being quotedI... (2 Replies)
Discussion started by: angrybb
2 Replies

4. Shell Programming and Scripting

Using sed to replace two different strings?

Hey everyone! Simple question - I am trying to use sed to replace two different strings. As it stands I can implement this as: sed -i 's/TIMEOUT//g' sed -i 's/null//g' And it works. However, is it possible to shrink that down into a single command? Will there be any performance benefits? (3 Replies)
Discussion started by: msarro
3 Replies

5. Shell Programming and Scripting

Using SED with variable to replace strings in while loop

Hi guys, Hi have this input (Menu.xml)<?xml version="1.0" encoding="ISO-8859-1"?> <breakfast_menu> <food> <name>Berry-Berry Belgian Waffles</name> <price>$8.95</price> <calories>900</calories> </food> <food> <name>French Toast</name> ... (6 Replies)
Discussion started by: cgkmal
6 Replies

6. Shell Programming and Scripting

sed and awk giving error ./sample.sh: line 13: sed: command not found

Hi, I am running a script sample.sh in bash environment .In the script i am using sed and awk commands which when executed individually from terminal they are getting executed normally but when i give these sed and awk commands in the script it is giving the below errors :- ./sample.sh: line... (12 Replies)
Discussion started by: satishmallidi
12 Replies

7. Programming

How to replace the complex strings from a file using sed or awk?

Dear All, I am having a requirement to find the difference between 2 files and generate a discrepancy report out of it as an html page. I prefer using diff -y file1 file2 since it gives user friendly layout to know any discrepancy in the record and unique records among the 2 file. Here's how it... (12 Replies)
Discussion started by: Badhrish
12 Replies

8. Shell Programming and Scripting

sed Find and Replace Text Between Two Strings or Words

I am looking for a sed in which I can recognize all of the text in between two indicators and then replace it with a place holder. For instance, the 1st indicator is a list of words "no|noone|havent" and the 2nd indicator is a list of punctuation ".|,|!".From a sentence such as "noone... (3 Replies)
Discussion started by: owwow14
3 Replies

9. UNIX for Beginners Questions & Answers

sed find 2 strings and replace one

Hi Everyone, I want to find this 2 strings in a single line a file and replace the second string. this is the line i need to find <param name="user" value="CORE_BI"/> find user and CORE_BI and replace only CORE_BI with admin so finally the line should look like this. <param... (5 Replies)
Discussion started by: shajay12
5 Replies

10. Shell Programming and Scripting

How to search and lossless replace strings using sed?

Hello, I would like to replace all occurencies of long data types by others (coresponding int) using 'sed' in the extensive source code of a software package written for 32 bit CPUs. I must use regular expressions to avoid wrong replacements like s/unsigned]+long/ulong/gLeaving out... (2 Replies)
Discussion started by: Mick P. F.
2 Replies
dns2tcpd(1)						      General Commands Manual						       dns2tcpd(1)

NAME
dns2tcpd - A tunneling tool that encapsulate TCP traffic over DNS. SYNOPSIS
dns2tcpd [ -h ] [ -F ] [ -i address ] [ -f config_file ] [ -p pidfile ] [ -d debug_level ] DESCRIPTION
dns2tcp is a network tool used to encapsulate TCP communications in DNS. When connections are received on a specific port all TCP traffic is sent to the remote dns2tcpd server and forwarded to a specific host and port. Multiple connections are supported. It was written for demonstration purposes OPTIONS
-h Help Menu -F Run in foreground -i IP address IP address to bind (default 0.0.0.0) -f config file Configuration file to use -p pidfile File where our pid will be written -d debug level Change debug level. Levels available are 1, 2 or 3. CONFIGURATION FILES
By default ${HOME}/.dns2tcprcd is used if no configuration file is specified. The resource syntax is <resource-name>:<server>:<port>. Mul- tiple resources can be defined in multilines, but must be comma separated. Here is an example : listen = 127.0.0.1 port = 53 user = nobody chroot = /tmp pid_file = /var/run/dns2tcp.pid domain = dns2tcp.hsc.fr debug_level = 0 resources = ssh:127.0.0.1:22 , smtp:127.0.0.1:25, pop3:10.0.0.1:110 AUTHORS
Olivier Dembour <olivier.dembour@hsc.fr> SEE ALSO
ssltunnel dns2tcpd(1)
All times are GMT -4. The time now is 07:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy