Hi all,
I'm looking for some help. I have a file (very long) that is organized like below:
>Cluster 0
0 283nt, >01_FRYJ6ZM12HMXZS... at +/99%
1 279nt, >01_FRYJ6ZM12HN12A... at +/99%
2 281nt, >01_FRYJ6ZM12HM4TS... at +/99%
3 283nt, >01_FRYJ6ZM12HM946... at +/99%
4 279nt,... (4 Replies)
Hi,
I have a written a shell script to get the previous line based on the pattern.
For example if a file has below lines:
----------------------------------------------
#UNBLOCK_As _per
#As per
205.162.42.92
#BLOCK_As_per
#-----------------------
#input checks
abc.com... (5 Replies)
I couldn't figure out how to use sed or any other shell to do the following. Can anyone help? Thanks.
If seeing a string (e.g., TODAY) in the line,
replace a string in the line above (e.g, replace "Raining" with "Sunny")
and replace a string in the line below (e.g., replace "Reading" with... (7 Replies)
Hi all,
on Solaris 10, I'd like to print a range of lines starting at pattern but also including the very first line before pattern.
the following doesn't print the range starting at pattern and going down to the end of file: cat <my file> | sed -n -e '/<pattern>{x;p;}/'
I need to include the... (1 Reply)
Hi I just wanted to add a new line after every matching pattern:
The method doing this doesn't matter, however, I have been using sed and this is what I tried doing, knowing that I am a bit off:
sed 'Wf a\'/n'/g'
Basically, I want to add a new line after occurrence of Wf. After the line Wf... (5 Replies)
Dear Unix Forums,
I am hoping you can help me with a pattern matching problem.
What am I trying to do?
I want to replace multiple lines of a text file (that match a multi-line pattern) with a single line of text. These patterns can span several lines and do not always have the same number of... (10 Replies)
Hi all!
Thanks for taking the time to view this!
I want to grep out all lines of a file that starts with pattern 1 but also does not match with the second pattern.
Example:
Drink a soda
Eat a banana
Eat multiple bananas
Drink an apple juice
Eat an apple
Eat multiple apples
I... (8 Replies)
The intended result should be :
PDF converters
'empty line'
gpdftext and pdftotext?xml version="1.0"?>
xml:space="preserve"><note-content version="0.1" xmlns:/tomboy/link" xmlns:size="http://beatniksoftware.com/tomboy/size">PDF converters
gpdftext and pdftotext</note-content>... (9 Replies)
I have the below plain text file where i have some result, in order to mail that result in html table format I have written the below script and its working well. cat result.txt
Page 2015-01-01 2000
Colors 2015-02-01 3000
Landing 2015-03-02 4000
#!/bin/sh LOG=/tmp/maillog.txt... (1 Reply)
Discussion started by: close2jay
1 Replies
LEARN ABOUT SUSE
match
MATCH(1L) Schily's USER COMMANDS MATCH(1L)NAME
match - searches for patterns in files
SYNOPSIS
match [ -option ] pattern [ file ... ]
DESCRIPTION
Match searches the named files or standard input (if no filenames are given) for the occurrences of the given pattern on each line. The
program accepts literal characters or special pattern matching characters. All lines that match the pattern are output on standard output.
You can only specify one pattern string for each match, however, you can construct an arbitrarily complex string. When you do not specify
a file, match can be used as a filter to display desired lines. Standard in is used if no files are specified.
OPTIONS -not, -v
Prints all lines that do not match.
-i Ignore the case of letters
-m Force not to use the magic mode
-w Search for pattern as a word
-x Display only those lines which match exactly
-c Display matching count for each file
-l Display name of each file which matches
-s Be silent indicate match in exit code
-h Do not display filenames
-n Precede matching lines with line number (with respect to the input file)
-b Precede matching lines with block number
REGULAR EXPRESSIONS
The following is a table of all the pattern matching characters:
c An ordinary character (not one of the special characters discussed below) is a one character regular expression that matches that
character.
c A backslash () followed by any special character is a one character regular expression that matches the special character itself.
The special characters are:
! # % * { } [ ] ? ^ $
! Logical OR as in match this!that!the_other. You may have to use `{}' for precedence grouping.
# A hash mark followed by any regular expression matches any number (including zero) occurrences of the regular expression.
? Matches exactly any one character. W? matches Wa, Wb, Wc, W1, W2, W3 ...
* Matches any number of any character.
% Matches exactly nothing. It can be used in groups of ored patterns to specify that an empty alternative is possible.
{} Curly brackets may be used to enclose patterns to specify a precedence grouping, and may be nested. {%!{test}}version matches the
strings testversion and version.
[string]
A non empty string of characters enclosed in square brackets is a one character regular expression that matches any one character in
that string. If however the first character of the string is a circumflex (^), the one character expression matches any character
which is not in the string. The ^ has this special meaning only if it occurs first in the string. The minus (-) may be used to indi-
cate a range of consecutive ASCII characters; for example, [0-9] is equivalent to any one of the digits. The - loses it's special
meaning if it occurs first (after an initial ^, if any) or last in the string. The right square bracket (]) and the backslash ()
must be quoted with a backslash if you want to use it within the string.
^ Matches the beginning of a line.
$ Matches the end of a line. (^*$ matches any entire line)
EXAMPLES FILES
None.
SEE ALSO grep(1), fgrep(1), egrep(1)DIAGNOSTICS NOTES
Even if a match occurs more than once per line, the line is output only once.
Quote special pattern matching characters to prevent them from being expanded by the Command Interpreter.
BUGS
The length of the pattern is currently limited to 100 characters.
This limit is reduced by 38 if the -w option is used.
Joerg Schilling 15. Juli 1988 MATCH(1L)