Delete a pattern including any whitespace before it and after it
Hello.
will remove 'SOME_WORD' and give :
A_PATTERN="SOME_WORD[[:space:]]"
will remove 'SOME_WORD' and the space after it and give :
Now the question
--------------------------
My problem is that the pattern is at the beginning of the line
I would like to remove the whitespace before and after it.
I tried this :
A_PATTERN="[[:space:]]SOME_WORD[[:space:]]"
should remove 'SOME_WORD' and the space before and after it.
But it does not work.
The pattern is at the beginning of the line and have white space after it.
But may or may not have white space before it.
ps (I made a try on a file where the pattern start at the beginning of the line without white space before it.)
Hello Experts,
I m newbie. Could u pls help me to write script on Sun solaris-
I have backup directory "/var/opt/backup/" where files are backed up in different directory "backup1" "backup2" "backup3".
I want to write a shell script which i will put in crontab and daily midnight it will... (1 Reply)
Hi,
I have been trying to remove whitespace from a file using sed. Here is an example of what im trying to do:
www1 = www1
www2 = www2
www3 = www3
and all the way to 300 and i want it to look like:
www1=www1
www2-www2
www3=www3
again upto 300
Any help... (12 Replies)
This is my first post, please be nice. I have tried to google and read different tutorials.
The task at hand is:
Input file input.txt (example)
abc123defhij-E-1234jslo
456ujs-W-abXjklp
From this file the task is to grep the -E- and -W- strings that are unique and write a new file... (5 Replies)
Hi
Following is an example line.
echo "192.22.22.22 \"33dffwef\" 200 300 dsdsd" | sed "s:\(\ *\ \):\1:"
I want it's output to be
200
However this is not the case. Can you tell me how to do it? I don't want to use AWK for this. Secondly, how can i fetch just 300? Should I use "\2"... (3 Replies)
Gurus,
I have a big file that needs to be sorted out and I cant figure out what to do. The file name is as below:
Name: xxxx yyyy nnnn
Description: dfffgs sdgsgsf hsfhhs
afgghhjdgj
fjklllll gsfhfh
Updated: jafgadsgg gsg
Corrected: date today
The file consists of line like these.
... (13 Replies)
Hi all,
Can anyone help me on this. I have several WP sites that are affected by sql injections. But the contents are different as follows
western union india belgaum
western union india bolegaon
western union india barhaj
western union india budhana
western union india belda
western... (6 Replies)
Hi All.
How can I convert this:
ABC_1_1
ABC_1_2
ABC_1_3
into this:
ABC_1 1
ABC_1 2
ABC_1 3
I tried this command but it is not working:
awk '{sub(/+$/,"\t", $1)}{print}'
Any suggestions on how to fix this?
Thank you :wall:
Please use code tags when posting data and... (3 Replies)
Hi all
I need your help to get a high-performance solution.
I am working on a extensive script to automate file restores using the bprestore tool on a Solaris 5.10 server (bash 3.00). I will only paste the needed parts of the script to avoid any confusion.
To use the script the user has to... (2 Replies)
Hello to all,
Maybe someone could help me, my question is:
How can a filter the print of command ls for the files with names of the form "abc*.txt" including the path?
I've done this:
If I move with command cd to /My/Path/Is/This/ and send this command:
ls -lst abc*.txt -i... (37 Replies)
Hello,
I have a data file consisting of many lines and my target is to delete all lines containing 0%
After some sed processes, I convert it to shown below format:
Sample webpage logfile:
Expected output is:
sed command is not working for below methods:
sed -n '/0%/p' logfile > output... (1 Reply)
Discussion started by: baris35
1 Replies
LEARN ABOUT MOJAVE
cidr_table
CIDR_TABLE(5) File Formats Manual CIDR_TABLE(5)NAME
cidr_table - format of Postfix CIDR tables
SYNOPSIS
postmap -q "string" cidr:/etc/postfix/filename
postmap -q - cidr:/etc/postfix/filename <inputfile
DESCRIPTION
The Postfix mail system uses optional lookup tables. These tables are usually in dbm or db format. Alternatively, lookup tables can be
specified in CIDR (Classless Inter-Domain Routing) form. In this case, each input is compared against a list of patterns. When a match is
found, the corresponding result is returned and the search is terminated.
To find out what types of lookup tables your Postfix system supports use the "postconf -m" command.
To test lookup tables, use the "postmap -q" command as described in the SYNOPSIS above.
TABLE FORMAT
The general form of a Postfix CIDR table is:
pattern result
When a search string matches the specified pattern, use the corresponding result value. The pattern must be in network/prefix or
network_address form (see ADDRESS PATTERN SYNTAX below).
!pattern result
When a search string does not match the specified pattern, use the specified result value. The pattern must be in network/prefix or
network_address form (see ADDRESS PATTERN SYNTAX below).
This feature is available in Postfix 3.2 and later.
if pattern
endif When a search string matches the specified pattern, match that search string against the patterns between if and endif. The pattern
must be in network/prefix or network_address form (see ADDRESS PATTERN SYNTAX below). The if..endif can nest.
Note: do not prepend whitespace to text between if..endif.
This feature is available in Postfix 3.2 and later.
if !pattern
endif When a search string does not match the specified pattern, match that search string against the patterns between if and endif. The
pattern must be in network/prefix or network_address form (see ADDRESS PATTERN SYNTAX below). The if..endif can nest.
Note: do not prepend whitespace to text between if..endif.
This feature is available in Postfix 3.2 and later.
blank lines and comments
Empty lines and whitespace-only lines are ignored, as are lines whose first non-whitespace character is a `#'.
multi-line text
A logical line starts with non-whitespace text. A line that starts with whitespace continues a logical line.
TABLE SEARCH ORDER
Patterns are applied in the order as specified in the table, until a pattern is found that matches the search string.
ADDRESS PATTERN SYNTAX
Postfix CIDR tables are pattern-based. A pattern is either a network_address which requires an exact match, or a network_address/pre-
fix_length where the prefix_length part specifies the length of the network_address prefix that must be matched (the other bits in the net-
work_address part must be zero).
An IPv4 network address is a sequence of four decimal octets separated by ".", and an IPv6 network address is a sequence of three to eight
hexadecimal octet pairs separated by ":" or "::", where the latter is short-hand for a sequence of one or more all-zero octet pairs. The
pattern 0.0.0.0/0 matches every IPv4 address, and ::/0 matches every IPv6 address. IPv6 support is available in Postfix 2.2 and later.
Before comparisons are made, lookup keys and table entries are converted from string to binary. Therefore, IPv6 patterns will be matched
regardless of leading zeros (a leading zero in an IPv4 address octet indicates octal notation).
Note: address information may be enclosed inside "[]" but this form is not required.
EXAMPLE SMTPD ACCESS MAP
/etc/postfix/main.cf:
smtpd_client_restrictions = ... cidr:/etc/postfix/client.cidr ...
/etc/postfix/client.cidr:
# Rule order matters. Put more specific whitelist entries
# before more general blacklist entries.
192.168.1.1 OK
192.168.0.0/16 REJECT
2001:db8::1 OK
2001:db8::/32 REJECT
SEE ALSO postmap(1), Postfix lookup table manager
regexp_table(5), format of regular expression tables
pcre_table(5), format of PCRE tables
README FILES
Use "postconf readme_directory" or "postconf html_directory" to locate this information.
DATABASE_README, Postfix lookup table overview
HISTORY
CIDR table support was introduced with Postfix version 2.1.
AUTHOR(S)
The CIDR table lookup code was originally written by:
Jozsef Kadlecsik
KFKI Research Institute for Particle and Nuclear Physics
POB. 49
1525 Budapest, Hungary
Adopted and adapted by:
Wietse Venema
IBM T.J. Watson Research
P.O. Box 704
Yorktown Heights, NY 10598, USA
Wietse Venema
Google, Inc.
111 8th Avenue
New York, NY 10011, USA
CIDR_TABLE(5)