01-16-2009
How to grep the text between patterns
Hi
I am having a very small problem,but just cdnt find out the solution.
I am having a file which has multiple entries as :
<id>QIIC.QA</id>
<id>.AEX</id>
<id>QIIC</id>
..
I want the output as
QIIC.QA
.AEX
QIIC
And then check which pattern has been repeated and how many times?
Please Help.
Thanks.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a file with 14million lines and I would like to extract all the unique lines from the file into another text file.
For example:
Contents of file1
happy
sad
smile
happy
funny
sad
I want to run a command against file one that only returns the unique lines (ie 1 line for happy... (3 Replies)
Discussion started by: soliberus
3 Replies
2. Shell Programming and Scripting
Hi all! Im trying to extract a portion of text from a file and put it into a new file. I need all the lines between <Placement> and </Placement> including the Placemark lines themselves. Is there a way to extract all instances of these and not just the first one found? I've tried using sed and... (4 Replies)
Discussion started by: Grizzly
4 Replies
3. Shell Programming and Scripting
I'm attempting to write a script to identify users who have sudo access on a server. I only want to extract the ID's of the sudo users after a unique line of text. The list of sudo users goes to the EOF so I only need the script to start after the unique line of text. I already have a script to... (1 Reply)
Discussion started by: bouncer
1 Replies
4. UNIX for Advanced & Expert Users
Is there a trick for copying from something like a powerpoint into vi? Every time I try to copy text from something like a powerpoint to vi my spacing gets messed up. I think it has something to do with my .vimrc file. When I renamed it was able to copy it in just fine so can someone please... (2 Replies)
Discussion started by: cokedude
2 Replies
5. UNIX for Dummies Questions & Answers
Hi All,
I'm hoping this is an easy question, but I'm having a weird problem trying to simply copy and paste text from MS Windows (XP) Notepad and then pasting into vi or vim in AIX. When I type "oslevel" I get "5.3.0.0". The problem is that once the text is pasted, there are sections of text... (2 Replies)
Discussion started by: PlainInverted
2 Replies
6. Shell Programming and Scripting
I would like to replace ], with ]]], between /* SECTION2-BEGIN */ and /* SECTION2-END */ in my file. My file contains the following information:
/* SECTION1-BEGIN */
,
/* SECTION1-END */
/* SECTION2-BEGIN */
,
/* SECTION2-END */
/*... (5 Replies)
Discussion started by: azdps
5 Replies
7. Shell Programming and Scripting
Hi All,
I want to extract the text between some pattern which occurs repeatedly in a file. For example my input is like,
/home/.....
..........java:25: cannot find symbol
............
/home/......
/home/.......
I want to display... (2 Replies)
Discussion started by: Vignesh58
2 Replies
8. Shell Programming and Scripting
I need to filter the text in between two patterns and output that to a different file. Please help me how to do it.
Ex:
.............
<some random text>
.............
Pattern_1
<Few lines that need to be output to different file>
Pattern_2
................
...............
<more text in... (4 Replies)
Discussion started by: metturr
4 Replies
9. Shell Programming and Scripting
awk -F "" '/<TestName>|<testname>|<Offerer>|<offerer>|<Line1>|<line1>|<City>|<city>|<State>|<state>/ {print $2, $3}' OFS='\t' UBE3A.xml > UBE3A.txt
Is it possible to use the code above to search for a pattern that is non-unique?
For example, if I wanted to capture the<MethodList>|<string>... (6 Replies)
Discussion started by: cmccabe
6 Replies
10. Shell Programming and Scripting
I am trying to use awk to print the unique entries in $2
So in the example below there are 3 lines but 2 of the lines match in $2 so only one is used in the output.
File.txt
chr17:29667512-29667673 NF1:exon.1;NF1:exon.2;NF1:exon.38;NF1:exon.4;NF1:exon.46;NF1:exon.47 703.807... (5 Replies)
Discussion started by: cmccabe
5 Replies
LEARN ABOUT BSD
expire.ctl
EXPIRE.CTL(5) File Formats Manual EXPIRE.CTL(5)
NAME
expire.ctl - control file for Usenet article expiration
DESCRIPTION
The file /etc/news/expire.ctl is the default control file for the expire(8) program, which reads it at start-up. Blank lines and lines
beginning with a number sign (``#'') are ignored. All other lines should be in one of two formats.
The first format specifies how long to keep a record of fully-expired articles. This is useful when a newsfeed intermittently offers older
news that is not kept around very long. (The case of very old news is handled by the ``-c'' flag of innd(8).) There should only be one
line in this format, which looks like this:
/remember/:days
Where days is a floating-point number that specifies the upper limit to remember a Message-ID, even if the article has already expired.
(It does not affect article expirations.)
Most of the lines in the file will consist of five colon-separated fields, as follows:
pattern:modflag:keep:default:purge
The pattern field is a list of wildmat(3)-style patterns, separated by commas. This field specifies the newsgroups to which the line is
applied. Note that the file is interpreted in order, so that the last line that matches will be used. This means that general patterns
(like a single asterisk to set the defaults) should appear before specific group specifications.
The modflag field can be used to further limit newsgroups to which the line applies, and should be chosen from the following set:
M Only moderated groups
U Only unmoderated groups
A All groups
The next three fields are used to determine how long an article should be kept. Each field should be either a number of days (fractions
like ``8.5'' are allowed) or the word ``never.'' The most common use is to specify the default value for how long an article should be
kept. The first and third fields -- keep and purge -- specify the boundaries within which an Expires header will be honored. They are
ignored if an article has no Expires header. The fields are specified in the file as ``lower-bound default upper-bound,'' and they are
explained in this order. Since most articles do not have explicit expiration dates, however, the second field tends to be the most impor-
tant one.
The keep field specifies how many days an article should be kept before it will be removed. No article in the newsgroup will be removed if
it has been filed for less then keep days, regardless of any expiration date. If this field is the word ``never'' then an article cannot
have been kept for enough days so it will never be expired.
The default field specifies how long to keep an article if no Expires header is present. If this field is the word ``never'' then articles
without explicit expiration dates will never be expired.
The purge field specifies the upper bound on how long an article can be kept. No article will be kept longer then the number of days spec-
ified by this field. All articles will be removed after then have been kept for purge days. If purge is the word ``never'' then the arti-
cle will never be deleted.
It is often useful to honor the expiration headers in articles, especially those in moderated groups. To do this, set keep to zero,
default to whatever value you wish, and purge to never. To ignore any Expires header, set all three fields to the same value.
There must be exactly one line with a pattern of ``*'' and a modflags of ``A'' -- this matches all groups and is used to set the expiration
default. It should be the first expiration line.
For example,
## How long to keep expired history
/remember/:5
## Most things stay for two weeks
*:A:14:14:14
## Believe expiration dates in moderated groups, up to six weeks
*:M:1:30:42
## Keep local stuff for a long time
foo.*:A:30:30:30
HISTORY
Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews. This is revision 1.15, dated 1996/10/29.
SEE ALSO
expire(8), wildmat(3).
EXPIRE.CTL(5)