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)
so i have been trying to learn how to manipulate text on my own and have gotten stumped...
let's say i have a text file that says (highly simplified):
people ordinary
How would swap the order of the words..
I know i need to use sed and some kind of back reference but cannot make it... (2 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)
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,
I tried to extract the time from `date` with sed.
(I know it works with `date +%H:%M:%S` as well)
I got three solutions of which just one worked. I thought "+" should repeat the previous expression 1 or more times and {n} should repeat the previous expression n times.
$ date
Thu... (9 Replies)
Hi,
I need to use the regex in the replacement string in SED command.
something like
sed -e ' s/\(^\{5\}\).\{150\}\(.*\)$/\10\{30\}1\{30\}A\{60\}B\{30\}\2/' abc
which means for all the lines in file abc that starts with 5 characters, I need to replace character 6-151... (6 Replies)
I plan to do something like this in awk that's embedded in a shell script.
I have extracted a text file using awk and the output is
before example:
<USDOLLARS|xxx>
I want to use get rid of the starting "<" and anything after the pipe "|"
after example:
USDOLLARS
How do I do that??
I... (8 Replies)
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 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)
hi
i would like to say "DATABASENAME=" to "TABLESNAME="
remove "," and press enter myconfig file
thanks (1 Reply)
Discussion started by: mnnn
1 Replies
LEARN ABOUT DEBIAN
re_exec
RE_COMP(3) Linux Programmer's Manual RE_COMP(3)NAME
re_comp, re_exec - BSD regex functions
SYNOPSIS
#define _REGEX_RE_COMP
#include <sys/types.h>
#include <regex.h>
char *re_comp(char *regex);
int re_exec(char *string);
DESCRIPTION
re_comp() is used to compile the null-terminated regular expression pointed to by regex. The compiled pattern occupies a static area, the
pattern buffer, which is overwritten by subsequent use of re_comp(). If regex is NULL, no operation is performed and the pattern buffer's
contents are not altered.
re_exec() is used to assess whether the null-terminated string pointed to by string matches the previously compiled regex.
RETURN VALUE
re_comp() returns NULL on successful compilation of regex otherwise it returns a pointer to an appropriate error message.
re_exec() returns 1 for a successful match, zero for failure.
CONFORMING TO
4.3BSD.
NOTES
These functions are obsolete; the functions documented in regcomp(3) should be used instead.
SEE ALSO regcomp(3), regex(7), GNU regex manual
COLOPHON
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
GNU 1995-07-14 RE_COMP(3)