---------- Post updated at 07:57 PM ---------- Previous update was at 07:17 PM ----------
Quote:
Originally Posted by thiuda
Why do I have to escape something like * and . to get the character and escape + and { to get the regex?
Isn't that a kind of counter logic?
Thanks for the help
The + sign is part of extended set of metacharacters used by egrep and awk and maybe supported by some new sed version but is not part of old standard implementation of sed.
could just be written such as
but i encountered the following case where the * match the shortest instead of the longest (on FreeBSD)
(i don't know whether this behaviour could be tweaked somewhere...) :
ooops, i just got aware that ...
... in fact the first * match the longest so that make the second one match the shortest this could lead to tricky unexpected result
so... the space matter :
I would like to do this:
replace the word "prod" with the word "special" but it may occur through the file naturally without a command, I only want it to happen when it has a specific command in front of it. The command will always look like this
<IMG,###,###,##,>prod/directory/IMG/file
... (4 Replies)
Hi all,
I'm writing a script that replaces a value in a file. The file is formatted as follows:
So, for this example, I'd like to replace the value for param_two. The value for param_two can be a one, or two-digit number. It replaces the value in file.cfg, and directs the... (9 Replies)
From my understanding when using regex1|regex2 the matching process tries each alternative in turn, from left to right, and the first one that succeeds is used.
When im trying to extract the name from those examples:
A) name.can.be.different.20.03.2009.boom
B)... (2 Replies)
Hello,
I am trying to covert a for statement into a single awk script and I've got everything but one part.
I also need to execute an external script when "not found", how can I do that ?
for TXT in `find debugme -name "*.txt"` ;do
FPATH=`echo $TXT | sed 's/\(.*\)\/\(.*\)/\1/'`
how... (7 Replies)
I am having trouble parsing rpm filenames in a shell script.. I found a snippet of perl code that will perform the task but I really don't have time to rewrite the entire script in perl. I cannot for the life of me convert this code into something sed-friendly:
if ($rpm =~ /(*)-(*)-(*)\.(.*)/)... (1 Reply)
Hi all, please can anyone show me how to use sed and regular expressions to achieve the following.
If a line contains a capital A followed by exactly 5 or 6 characters followed by an angled bracket then insert an asterix before the angled bracket.
So:
XCONFIGA12345<X
Becomes:
... (5 Replies)
I have regular sed on my computer. I am trying to find out a regex for one-four letters.
I have tried
(\{1,4\}
This will match one or four characters, but what if the expression has two characters?
Like AB1234
I don't have GNUsed and am having trouble with this regex. (5 Replies)
Hi guys,
I am coding a bash script that makes use of php scripts to pull URL's from a website. These url links will have numbers in them like 0.2.3
I want to make a regex that will yield me such numbers if I use a command like preg_grep.
Question1: I need a regex that will tell my preg_grep... (2 Replies)
I am using the following sed script to remove new lines (\r\n and \n), except from lines starting with >:
sed -i ':a /^>/!N;s/\r\n\(\)/\1/;s/\n\(\)/\1/;ta'
Is there a way to include both \r\n and \n in one regex to avoid the second substitute script (s/\n\(\)/\1/)? (4 Replies)