Sponsored Content
Full Discussion: sed match exactly and delete
Top Forums Shell Programming and Scripting sed match exactly and delete Post 302935608 by RudiC on Wednesday 18th of February 2015 05:24:21 AM
Old 02-18-2015
Anchor the pattern :
Code:
sed -e '/^dns.com$/,+2d' file
mydns.com
11
22
dns.com.au
11
22
LAST LINE

This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to delete lines do NOT match a pattern

On Unix, it is easy to get those lines that match a pattern, by grep pattern file or those lines that do not, by grep -v pattern file but I am editing a file on Windows with Ultraedit. Ultraedit support regular expression based search and replace. I can delete all the lines that match a... (1 Reply)
Discussion started by: JumboGeng
1 Replies

2. Shell Programming and Scripting

SED: match pattern & delete matched lines

Hi all, I have the following data in a file x.csv: > ,this is some text here > ,,,,,,,,,,,,,,,,2006/11/16,0.23 > ,,,,,,,,,,,,,,,,2006/12/16,0.88 < ,,,,,,,,,,,,,,,,this shouldnt be deleted I need to use SED to match anything with a > in the line and delete that line, can someone help... (7 Replies)
Discussion started by: not4google
7 Replies

3. Shell Programming and Scripting

sed: find match and delete the line above

I am searching a dhcpd.conf to find the hardware ethernet match, then once the match is found delete just the line above it. For example: testmachine.example { hardware ethernet 00:00:00:00:00:00; fixed address 192.168.1.100; next-server 192.168.1.101; filename "linux-install/pxelinux.0"; }... (3 Replies)
Discussion started by: cstovall
3 Replies

4. Shell Programming and Scripting

Sed to delete exactly match pattern and print them in other file

Hi there, I need help about using sed. Iam using sed to delete and print lines that match the port number as listed in sedfile. I am using -d and -p command for delete match port and print them respectively. However, the output is not synchonize where the total deleted lines is not similar with... (3 Replies)
Discussion started by: new_buddy
3 Replies

5. Shell Programming and Scripting

sed problem - delete all lines until a match on 2 lines

First of all, I know this can be more eassily done with perl or other scripting languages but, that's not the issue. I need this in sed. (or wander if it's possible ) I got a file (trace file to recreate the control file from oracle for the dba boys) which contains some lines another line... (11 Replies)
Discussion started by: plelie2
11 Replies

6. UNIX for Advanced & Expert Users

On Match Delete Field

Hi, A text file contains lines of fields seperated by some delimiter; space for example; some lines but not all will have in the second field a value like an inital (e.g., A. or B. or Jr.) for those lines with such a value in field 2, we wish to have that value deleted. We also wish to do this... (1 Reply)
Discussion started by: rfransix
1 Replies

7. Shell Programming and Scripting

Sed delete blank lines upto first pattern match

Hi Im trying to do the following in sed. I want to delete any blank line at the start of a file until it matches a pattern and then stops. for example: Input output: I have got it to work within a range of two patterns with the following: sed '/1/,/pattern/{/^]*$/d}' The... (2 Replies)
Discussion started by: duonut
2 Replies

8. Shell Programming and Scripting

Delete the last line if match the string

Hi, How to delete the last line if is match the below string else no action... String checking "END OF FILE. ROW COUNT: " 9f680174-cb87-4f71-887a-93b6f62fa5aa|20077337254|2 9f680174-cb87-4f71-887a-93b6f62fa5aa|20077337254|0 229f680174-cb87-4f71-887a-93b6f62fa5aa|20077337254|3 END OF... (2 Replies)
Discussion started by: bmk
2 Replies

9. Ubuntu

Delete all files that match date '+%Y-%m-%d_%H:%M'

I need to modify this so it delete all date files and not leave the 2 newest. TARGET_DIR='/media/andy/MAXTOR_SDB1/Ubuntu_Mate_18.04/' REGEX='{4}-{2}-{2}_{2}:{2}' # regular expression that match to: date '+%Y-%m-%d_%H:%M' LATEST_FILE="$(ls "$TARGET_DIR" | egrep "^${REGEX}$" | tail -1)"... (4 Replies)
Discussion started by: drew77
4 Replies

10. UNIX for Beginners Questions & Answers

sed script to delete the last word after a last pattern match

Hi Guys , I am having a file as stated below File 1 sa0 -- i_core/i_core_apb/i_afe0_controller/U261/A sa0 -- i_core/i_core_apb/i_afe0_controller/U265/Z sa1 -- i_core/i_core_apb/i_afe0_controller/U265/A sa1 -- i_core/i_core_apb/i_afe0_controller/U268/Z sa1 -- ... (7 Replies)
Discussion started by: kshitij
7 Replies
dns2tcpc(1)						      General Commands Manual						       dns2tcpc(1)

NAME
dns2tcpc - A tunneling tool that encapsulate TCP traffic over DNS. SYNOPSIS
dns2tcpc [ -h ] [ -c ] [ -z domain zone ] [ -d debug_level ] [ -r resource ] [ -k key ] [ -f config_file ] [ -e command ] [ -T request type ] [ -l local_port ] [ server ] DESCRIPTION
dns2tcpc 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. dns2tcpc was written for demonstration purposes. OPTIONS
-h Help Menu -c Enable DNS compression. When used, be sure that all relay and DNS server support compression and really use it. -z domain zone Use this domain as endpoint. -d debug level Change debug level. Levels available are 1, 2 or 3. -r resource Remote resource to access. -k key Pre shared key used for authentication (identification). -f config file Configuration file to use. -T request type Request type to use. Actually only KEY and TXT requests are supported. -e command Command to execute, I/O are redirected in the tunnel. -l local_port Local port accepting incomming connections (or - for stdin on UNIX systems). -t connection timeout Maximum DNS server's answer delay in seconds. A valid delay is between 1 and 240 seconds. Default is 3. server DNS server to use. The first entry in resolv.conf file will be choosen if the server is not specified. CONFIGURATION FILES
By default ${HOME}/.dns2tcprc is used if no configuration file is specified. Here is an example : domain = dns2tcp.hsc.fr resource = ssltunnel local_port = 4430 enable_compression = 0 debug_level = 1 key = mykey # DNS to use server = ns.hsc.fr EXAMPLES
dns2tcpc -k mykey -z dns2tcp.hsc.fr mydns Ask the dns2tcp server to list available resources. ssh -o 'ProxyCommand dns2tcpc -r ssh -l - -z dns2tcp.hsc.fr -k mykey mydns' myserver Use dns2tcp as a proxy command with ssh. We try to connect to the ssh resource with the key 'mykey' and the DNS mydns. dns2tcpc -r socat-resource -e '/bin/bash -i' -k mykey -z dns2tcp.hsc.fr mydns Use dns2tcp as a reverse shell, the remote shell will appear on the socat-resource. dns2tcpc -d 1 -f /dev/null -r ssl-tunnel -l 2000 -k mykey -T KEY -z dns2tcp.hsc.fr mydns Do not use the default configuration file, bind local port 2000 and forward all the traffic on the remote ssl-tunnel resource, use the first debug level. Use KEY type DNS requests. AUTHORS
Olivier Dembour <olivier.dembour@hsc.fr> SEE ALSO
ssltunnel dns2tcpc(1)
All times are GMT -4. The time now is 01:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy