All Questions
9
questions
0
votes
1
answer
90
views
Putting single quote in the begining of column
I have a .txt file with publications for which columns are separated by a single space.
However, titles also have spaces an in order to separate the columns correctly I need to have all titles in ...
0
votes
1
answer
344
views
\1 in sed command not working under xonsh
I don't understand what I'm missing here:
$ echo 'testing' | sed -E 's/([a-z]*)ing/\1ing/g'
ing
I would expect the output to be testing again, since \1 should be test? That input seems to have been ...
6
votes
1
answer
678
views
Why can't I escape the braces "]" in sed?
Question: Why can't I escape the "]"?
$ printf "*#$@~\!&*()[]\n"
*#~\!&*()[]
$ printf "*#$@~\!&*()[]\n" | sed 's/[*#$@~!&*()\[\]]//g'
*#~\!&*()
$
1
vote
2
answers
2k
views
Why does regex with \\$\{ work with egrep, but not with sed?
Given a text like this
./RFF_09 -f${FILE} -c${COND}
inside a file, this egrep command will correctly match:
egrep './RFF(.*) (.*)-c\\$\{COND\}' file
but this sed command will not
sed -n "s:'./RFF(...
1
vote
0
answers
76
views
Take the unknown contents of variable as literal in sed [duplicate]
I have two files: a.patterns contains patterns in a one per line way
"`"
"^"
"<"
"<("
"<)"
"<["
"="
">"
"_;|^+*+?@"
and b.data contains comma separated values.
1,1,0,"*",1
2,1,1,"*",...
1
vote
1
answer
7k
views
How to escape unbalanced brackets or slash in sed?
I'm trying to use sed, but my pattern contains [] brackets and slashes (/).
I've tried quotes, but it doesn't help.
How do I escape it?
Examples:
$ sed -i'.bak' "s/^includes[] =/;includes[] =/g" *...
2
votes
2
answers
1k
views
What does this regex mean?
I was working on the conversion of Unix newline to Windows newline. I tried to unix2dos but it gave me some binary error, so I looked it up and stumbled upon this regex
sed 's/$'"/`echo \\\r`/" input....
13
votes
2
answers
5k
views
Why do I need to escape regex characters in sed to be interpreted as regex characters?
It seems e.g.
cat sed_data.txt | sed 's/\b[0-9]\{3\}\b/NUMBER/g'
that I must escape characters to form a regular expression. In this case I had to escape braces in order to be interpreted as a number ...
228
votes
7
answers
723k
views
Using sed to find and replace complex string (preferrably with regex)
I have a file with the following contents:
<username><![CDATA[name]]></username>
<password><![CDATA[password]]></password>
<dbname><![CDATA[name]]></...