04-06-2007
thanks,
that was just an example, I want to cut out two or more strings out of a line or replace it with any other string I specify
what I want two know is how to combine search strings, like find string1 and string2 and string3 and replace all of them with the same string, and all in the same sed command
like sed 's/string1 AND string2 AND string3/string4/g'
should replace any appearance of string1, string2 and string3 with the same string, string4
which can be in any order in one line, with 100 other strings
hope its clear what I mean
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Is there an easier way to do the following:
echo "|||||||" | sed 's/||/|0|/g; s/||/|0|/g'
which would give the following
|0|0|0|0|0|0|
If it is not run twice it will not pick up the second occurance of the || and leave it empty as in
echo "|||||||" | sed 's/||/|0|/g'
which would give... (3 Replies)
Discussion started by: maverick
3 Replies
2. UNIX for Dummies Questions & Answers
Ok what is BSD exactly? I know its a type of open source but what is it exactly? (1 Reply)
Discussion started by: Corrail
1 Replies
3. Shell Programming and Scripting
Hello
My file looks like that =>
12.56 have then 7888778.2566 what 44454.54545
878787.66565 if else 4445.54545455
I want to change all '.' on ',' .
I'm trying to do it with sed but I don't know chow to build regular expression to
change 454.4466 on 454,4466 ? (13 Replies)
Discussion started by: scotty_123
13 Replies
4. Shell Programming and Scripting
I have a file
CREATE TABLE DDD_EXT --- 1000
(
val u1
val u1
);
CREATE TABLE dsdasd_EXT --- 1323
(
val u1
val u1
);
CREATE TABLE AAAAAA_EXT --- 1222
(
val u1
val u1
);
CREATE TABLE E_EXT --- 11
(
val u1
val u1 (2 Replies)
Discussion started by: jville
2 Replies
5. Shell Programming and Scripting
How do I remove parentheses using sed?
input (192.168.1.1)
output 192.168.1.1 (4 Replies)
Discussion started by: streetfighter2
4 Replies
6. Shell Programming and Scripting
I have a log output with a format similar to this:
a=1, b= 2
c=0, d= 45, e=100
... and so on.
I figure I can just use awk or something to pipe the file to sed, but I'm trying to replace all the values above with 0.
I've tried:
cat blah | sed 's/=\(.*\),/0/'but that didn't work. ... (6 Replies)
Discussion started by: throw_a_stick
6 Replies
7. Shell Programming and Scripting
I have the following line an in input file I want to digest with sed and simple replace the bold part with a variable defined in my bash script. I can do this in several sed operations but I know there must be a way to do it in a single sed line. What is the syntax?
Line in file:... (1 Reply)
Discussion started by: graysky
1 Replies
8. Shell Programming and Scripting
Script newbie, so I'm sure I'm missing something obvious here, but how come this simple script does not work?
#!/bin/bash ... (3 Replies)
Discussion started by: KidCactus
3 Replies
9. Red Hat
Cheers!
In /etc/syslog.conf, if an error type is not specified, is it logged anywhere (most preferable is it logged to /var/log/messages) or not?
To be more precise I am interested in error and critical level messages. At default these errors are not specified in syslog.conf, and I need to... (6 Replies)
Discussion started by: dr1zzt3r
6 Replies
10. UNIX for Beginners Questions & Answers
I don't understand this command behavior.
echo "abc" |sed 's/a/&_&/' (4 Replies)
Discussion started by: Vartika18
4 Replies
LEARN ABOUT PHP
ctype_print
CTYPE_PRINT(3) 1 CTYPE_PRINT(3)
ctype_print - Check for printable character(s)
SYNOPSIS
bool ctype_print (string $text)
DESCRIPTION
Checks if all of the characters in the provided string, $text, are printable.
PARAMETERS
o $text
- The tested string.
RETURN VALUES
Returns TRUE if every character in $text will actually create output (including blanks). Returns FALSE if $text contains control charac-
ters or characters that do not have any output or control function at all.
EXAMPLES
Example #1
A ctype_print(3) example
<?php
$strings = array('string1' => "asdf
", 'string2' => 'arf12', 'string3' => 'LKA#@%.54');
foreach ($strings as $name => $testcase) {
if (ctype_print($testcase)) {
echo "The string '$name' consists of all printable characters.
";
} else {
echo "The string '$name' does not consist of all printable characters.
";
}
}
?>
The above example will output:
The string 'string1' does not consist of all printable characters.
The string 'string2' consists of all printable characters.
The string 'string3' consists of all printable characters.
NOTES
Note
If an integer between -128 and 255 inclusive is provided, it is interpreted as the ASCII value of a single character (negative val-
ues have 256 added in order to allow characters in the Extended ASCII range). Any other integer is interpreted as a string contain-
ing the decimal digits of the integer.
SEE ALSO
ctype_cntrl(3), ctype_graph(3), ctype_punct(3).
PHP Documentation Group CTYPE_PRINT(3)