Sponsored Content
Top Forums Shell Programming and Scripting sed - replacing a substring containing a hyphen Post 302955551 by squrcles on Friday 18th of September 2015 12:12:05 PM
Old 09-18-2015
sed - replacing a substring containing a hyphen

I'm attempting to replace a substring that contains a hyphen and not having much success, can anyone point out where i'm going wrong or suggest an alternative.

Code:
[root@localhost kvm]#  echo /var/lib/libvirt/images/vm888b-clone.qcow | sed -e 's|vm888-clone|qaz|g'
/var/lib/libvirt/images/vm888b-clone.qcow


Last edited by vbe; 09-18-2015 at 01:36 PM.. Reason: square brackets for code tags... hehe...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sed extract substring on (OS X)

On OS 10.4.11 I have filenames like: 670711 SA T2 v1-1_DS_EF.doc CT_670520 AM T1 v1-2_DS_EF.doc CT_670716 - 2 SA T4 v1-2_DS_EF.doc CT_670713 SA T3 v1-1_DS_EF.doc 670421 PA DYP1 v1-1_DS_EF.doc CT_670425 PA DYP2 v1-1_DS_EF.doc CT_670107 RA T3 v1-2_DS_EF.doc CT_670521 AM T2 v1-2_DS_EF.doc... (3 Replies)
Discussion started by: mlommel
3 Replies

2. Shell Programming and Scripting

Using sed to get a substring

Hi, I have looked all over for this. I am attempting to get a the substring of a string using sed since it seemed the best solution for this. For example my string is: "zzz foo to you and bar123 or foo" I would like to extract the text between "and" and "or" (it could be anything, but... (2 Replies)
Discussion started by: CentaurAtlas
2 Replies

3. Shell Programming and Scripting

Substring using sed or awk

I am trying to get a substring from a string stored in a variable. I tried sed with a bit help from this forum, but not successful. Here is my problem. My string is: "REPLYFILE=myfile.txt" And I need: myfile.txt (everything after the = symbol). My string is: "myfile.txt.gz.20091120.enc... (5 Replies)
Discussion started by: jamjam10k
5 Replies

4. Shell Programming and Scripting

Sed and SubString

Hi Folks, I am here with a simple doubt. I am having a flat file in which I want to replace the characters from say 5 to 15 as some text. Flat file contains a single line. For example 01MRRAJESH21000RAJESH INDUSTRIES In the above line pos 16-21 is Rajesh, I want to search for the... (4 Replies)
Discussion started by: dinesh1985
4 Replies

5. Shell Programming and Scripting

Making substring with sed

Input: You can easily do this by highlighting your code. How can i get the substring from index 9 to 12 using sed? (6 Replies)
Discussion started by: cola
6 Replies

6. Programming

sed no match word end with hyphen

Hi, This is my first post.It has two parts first part: I want to match a line that starts with whitespace tab or similar followed by must start with specific word and not match same word start with hyphen like this: grep height file1: height: 150px; line-height: 1.5em; height:... (4 Replies)
Discussion started by: medium_linux
4 Replies

7. Shell Programming and Scripting

Replacing a string with its substring

Hi All, Below is some sample content of my input file: There are many types and traditions of anarchism, some of which are ]. Strains of anarchism have been divided into the categories of ] and ] or similar dual classifications. Anarchism is often considered to be a radical ] ideology, and... (8 Replies)
Discussion started by: satheeshkumar
8 Replies

8. Shell Programming and Scripting

Substring Problem with sed . . .

Greetings. I'm looking to isolate the first occurrence of an arbitrary substring which may be present at any particular line in a given file. The enclosing end markers for the target in our thought problem are string" and ". The complete string and surrounding text could look something like... (3 Replies)
Discussion started by: LinQ
3 Replies

9. Shell Programming and Scripting

Insert a hyphen between two delimiters using sed

Hey guys, I have a file that is delimited by | and I am trying to write a sed command to convert this: abc|def||ghi|jkl||||mnop into this: abc|def|-|ghi|jkl|-|-|-|mnop The output I am getting out of: sed -e "s/+//g" /tmp/opt.del > /tmp/opt2.del is like: ... (9 Replies)
Discussion started by: prohank
9 Replies

10. Shell Programming and Scripting

Replacing space with hyphen in a pattern.

I have a huge text file, about 52 GB. In the file, there are patterns like these: ] ] ] ]One can see that there is text within patterns such as and ], and I am only interested in ]. There is text before and after all these patterns too, for example, ''Anarchism''' is a ] that advocates ]... (3 Replies)
Discussion started by: shoaibjameel123
3 Replies
LIBVIRTMIB_SUBAGENT(1)					      Virtualization Support					    LIBVIRTMIB_SUBAGENT(1)

NAME
libvirtMib_subagent - SNMP subagent for libvirt SYNOPSIS
libvirtMib_subagent [OPTIONS] [LISTENING ADDRESSES] DESCRIPTION
The libvirtMib_subagent provides SNMP functionality for libvirt. Therefore it is now possible to gather and set domain status over SNMP from one place. This allows to create views of entire platforms end to end. It communicates with SNMP agent over AgentX protocol (RFC 2741) and extends agent's set of infomation provided. Therefore, we need a running SNMP agent. This behaviour can be avoided using -M option. The libvirtMib_subagent understands these OPTIONS: -f Don't fork. Run in foreground. -D[token[,...]] Turn on debugging output for the given TOKEN(s). Without any tokens specified, it defaults to printing all the tokens (which is equivalent to the keyword '"ALL"'). You might want to try ALL for extremely verbose output. Note: You can't put a space between the -D and the tokens. -H Display a list of configuration file directives understood by the agent and then exit. -M Run as a normal SNMP Agent instead of an AgentX sub-agent. -xADDRESS Connect to master agent at ADDRESS (default "/var/agentx/master"). The address can either be a Unix domain socket path, or the address of a network interface. The format is the same as the format of listening addresses described below. -L Do not open a log file; print all messages to stderr. The last optional LISTENING ADDRESSES specify on which addresses should subagent running in normal SNMP Agent mode listen for incoming requests. See snmpd for further information. BUGS
Report any bugs discovered to the libvirt community via the mailing list "http://libvirt.org/contact.html" or bug tracker "http://libvirt.org/bugs.html". Alternatively report bugs to your software distributor / vendor. AUTHORS
Please refer to the AUTHORS file distributed with libvirt. COPYRIGHT
Copyright (C) 2011 Red Hat, Inc., and the authors listed in the libvirt-snmp AUTHORS file. LICENSE
libvirt-snmp is distributed under the terms of the GNU GPL v3. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE SEE ALSO snmpd, <;http://www.libvirt.org> libvirt-snmp-0.0.3 2012-09-07 LIBVIRTMIB_SUBAGENT(1)
All times are GMT -4. The time now is 12:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy