This means "replace the first character which isn't a 'x' with nothing". Since that's done as soon as the first 't' is replaced, sed is finished. If you want to remove all characters leading up to the first 'x', use
In the second snipped:
you're replacing as many characters as possible from the start until the last possible 'a' with the matched 'a'. The rest of the string isn't affected, so 'x_a_b_a_c_a' is replaced by 'a', which changes 'x_a_b_a_c_a_d' to 'a_d'
Third:
means "starting with a dash, take as many non-dash characters as possible until the end, and replace them with nothing", or "remove everything starting from and including the last possible dash".
Hello..
i want to use variable in sed..
like
sed 's/ROOTMAILID/$variable/g' conf.test
but its not working..
please help
thanks in advance
esham (2 Replies)
hi all,
i have a variable exported as
VAR=ATTRIB
then tried with,
echo "tt" | sed 's/^/$VAR/'
expected result as
ttATTRIB
but obtained only,
$VARtt
i could nt get where i am wrong.
Thanks. (3 Replies)
PLEASE EXPLANIN ME...
sed 's~\(.*\)\(<name>\)\(.*\)\(</name>\)\(.*\)~\2\3\4~'
this is the format
<start><name>123<\name><addr>BAC<\addr><loc>sfo<\loc></start> (1 Reply)
Hi,
The following command works fine for me, but I could not grasp the logic working behind of sed command, it's obscure to me :( :confused:
echo "./20080916/core/audioex.amr" | sed "s%\(\)/%\1_%g"
o/p: ./20080916_core_audioex.amr
Could anyone please explain to me in detail, that how... (6 Replies)
Hi,
i need find and replace a sting with a new variable having value as spaces in between.
Eg:
set a = "i am variable"
set b = "i am second"
sed -e 's/find_string/'$a'/g' -e 's/find2_str/'$b'/g' input_file
here it is giving error...
How to get an varaible, which is... (6 Replies)
Hi,
I need to get the value of 'uid' from a line in file f1. For example, in the line below, I need to get the value '150', from the 'anonuid=150' key, and I need to verify that this is a valid uid by checking it against /etc/passwd (i.e) I want to compare this uid, 150 (or more if there are any... (2 Replies)
Hi All
Can some one explain what does the given two sed commands do :confused:
sed "s/\'/\\\'/g" |
sed 's/\"/\\\"/g'
Please find the sample code i used to find out what this is doing , but it has confused me more :wall:
$ cat sri1.txt
\
'
"
$ sed 's/\"/\\\"/g' sri1.txt
\
'... (5 Replies)
Discussion started by: Sri3001
5 Replies
LEARN ABOUT REDHAT
tk_getdash
Tk_GetDash(3) Tk Library Procedures Tk_GetDash(3)__________________________________________________________________________________________________________________________________________________NAME
Tk_GetDash - convert from string to valid dash structure.
SYNOPSIS
#include <tk.h>
int
Tk_GetDash(interp, string, dashPtr)
ARGUMENTS
Tcl_Interp *interp (in) Interpreter to use for error reporting.
const char * string (in) Textual value to be converted.
Tk_Dash *dashPtr (out) Points to place to store the dash pattern value converted from string.
_________________________________________________________________DESCRIPTION
These procedure parses the string and fills in the result in the Tk_Dash structure. The string can be a list of integers or a character
string containing only ".,-_" or spaces. If all goes well, TCL_OK is returned. If string does not have the proper syntax then TCL_ERROR is
returned, an error message is left in the interpreter's result, and nothing is stored at *dashPtr.
The first possible syntax is a list of integers. Each element represents the number of pixels of a line segment. Only the odd segments are
drawn using the "outline" color. The other segments are drawn transparent.
The second possible syntax is a character list containing only 5 possible characters ".,-_ ". The space can be used to enlarge the space
between other line elements, and can not occur as the first position in the string. Some examples:
-dash . = -dash {2 4}
-dash - = -dash {6 4}
-dash -. = -dash {6 4 2 4}
-dash -.. = -dash {6 4 2 4 2 4}
-dash {. } = -dash {2 8}
-dash , = -dash {4 4}
The main difference of this syntax with the previous is that it is shape-conserving. This means that all values in the dash list will be
multiplied by the line width before display. This assures that "." will always be displayed as a dot and "-" always as a dash regardless
of the line width.
On systems where only a limited set of dash patterns, the dash pattern will be displayed as the most close dash pattern that is available.
For example, on Windows only the first 4 of the above examples are available. The last 2 examples will be displayed identically as the
first one.
KEYWORDS
dash, conversion
Tk 8.3 Tk_GetDash(3)