02-03-2016
If you have latest grep you have below options in grep
Context Line Control
Quote:
-A NUM, --after-context=NUM
Print NUM lines of trailing context after matching lines. Places a line containing a group separator (--) between contiguous
groups of matches. With the -o or --only-matching option, this has no effect and a warning is given.
-B NUM, --before-context=NUM
Print NUM lines of leading context before matching lines. Places a line containing a group separator (--) between contiguous
groups of matches. With the -o or --only-matching option, this has no effect and a warning is given.
-C NUM, -NUM, --context=NUM
Print NUM lines of output context. Places a line containing a group separator (--) between contiguous groups of matches. With
the -o or --only-matching option, this has no effect and a warning is given.
or you can use awk
awk 'c-->0;/pattern/{c=98}' Infile
This User Gave Thanks to vidyadhar85 For This Post:
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
1 . Thanks everyone who read the post first.
2 . I have a log file which size is 143M , I can not use vi open it .I can not use xedit open it too.
How to view it ?
If I want to view 200-300 ,how can I implement it
3 . Thanks (3 Replies)
Discussion started by: chenhao_no1
3 Replies
2. Shell Programming and Scripting
Hi all,
I'm new to shell scripting.
I want to copy initial few lines(say first 10 lines) from a file to another file.
There is no "head" command in our embedded system.
sed & awk is there which I believe will do that, but I dont know how to.
This is linux 2.6 (embedded)
So please help me.... (5 Replies)
Discussion started by: jockey007
5 Replies
3. UNIX for Dummies Questions & Answers
I have a 5000 line config.log file with several "maybe" errors. Any reccomendations on finding solvable problems? (2 Replies)
Discussion started by: NeedLotsofHelp
2 Replies
4. Shell Programming and Scripting
I have a command which prints #lines after and before the search string in the huge file
nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r;print;c=a}b{r=$0}' b=0 a=10 s="STRING1" FILE
The file is 5 gig big.
It works great and prints 10 lines after the lines which contains search string in... (8 Replies)
Discussion started by: prash184u
8 Replies
5. Shell Programming and Scripting
Hi,
I have a big (2.7 GB) text file. Each lines has '|' saperator to saperate each columns.
I want to delete those lines which has text like '|0|0|0|0|0'
I tried:
sed '/|0|0|0|0|0/d' test.txt
Unfortunately, it scans the file but does nothing.
file content sample:... (4 Replies)
Discussion started by: dipeshvshah
4 Replies
6. Shell Programming and Scripting
Hi Guys,
I have an awk script that would search the input file for line that starts with a number 3 and copies into a new text file.
I want to extend this script to find the lines that either starts with 3 or a or b and copy all those lines into the new file.
Here is what I have so far:... (1 Reply)
Discussion started by: Amith821
1 Replies
7. UNIX for Advanced & Expert Users
Hi,
I need a unix command to delete first n (say 100) lines from a log file. I need to delete some lines from the file without using any temporary file. I found sed -i is an useful command for this but its not supported in my environment( AIX 6.1 ). File size is approx 100MB.
Thanks in... (18 Replies)
Discussion started by: unohu
18 Replies
8. UNIX for Dummies Questions & Answers
Requirement:
When I do ls -ltr /home/data/orders I get a huge list of files, I need to copy that last 50 to another directory say /home/work/ later, I will do my ETL process and then again I need to copy from 51 to 100 and so on.
What is the command to copy files specifying 1 to 50... (5 Replies)
Discussion started by: eskay
5 Replies
9. Shell Programming and Scripting
Hi All,
I am trying to get some lines from a file i did it with while-do-loop. since the files are huge it is taking much time. now i want to make it faster.
The requirement is the file will be having 1 million lines.
The format is like below.
##transaction, , , ,blah, blah... (38 Replies)
Discussion started by: mad man
38 Replies
10. Shell Programming and Scripting
OS : RHEL 7.2
Shell : bash
I have a file which has lines like below
I want to copy from 2nd line to the 6th line and copy(redirect) those lines to another file.
$ cat patterns.txt
hello world
hello asia
hello europe
hello africa
hello america
hello antartica
hello... (9 Replies)
Discussion started by: omega3
9 Replies
LEARN ABOUT DEBIAN
clonalframe
ClonalFrame(1) General Commands Manual ClonalFrame(1)
NAME
ClonalFrame - inference of bacterial microevolution using multilocus sequence data
SYNOPSIS
ClonalFrame [OPTIONS] inputfile outputfile
DESCRIPTION
ClonalFrame identifies the clonal relationships between the members of a sample, while also estimating the chromosomal position of homolo-
gous recombination events that have disrupted the clonal inheritance.
Options:
-x NUM Sets the number of iterations after burn-in (default is 50000)
-y NUM Sets the number of burn-in iterations (default is 50000)
-z NUM Sets the number of iterations between samples (default is 100)
-e NUM Sets the number of branch-swapping moves per iterations (default is so that half of the time is spent branch-swapping)
-m NUM Sets the initial value of theta to NUM (default is Watterson estimate)
-d NUM Sets the initial value of delta to NUM (default is 0.001)
-n NUM Sets the initial value of nu to NUM (default is 0.01)
-r NUM Sets the initial value of R to NUM (default is initial theta/10)
-M Do update the value of theta
-D Do not update the value of delta
-N Do not update the value of nu
-R Do not update the value of R
-T Do not update the topology
-A Do not update the ages of the nodes
-G Remove all gaps
-H Remove all gaps at non-polymorphic positions
-t NUM Indicate which initial tree to use: 0 for a null tree, 1 for a uniformly chosen coalescent tree and 2 for UPGMA tree (default)
-w FILE
Use Newick file for initial tree
-a NUM Sets the first parameter of the beta prior distribution of nu
-b NUM Sets the second parameter of the beta prior distribution of nu
-U Use uniform priors for rho, theta and delta
-B Run in BURST mode
-C Run in UPGMA mode with a site-by-site bootstrap procedure
-c Run in UPGMA mode with a fragment-by-fragment bootstrap procedure
-S NUM Sets the seed for the random number generator to NUM
-E NUM Sets the rate of exponential growth (default is 0)
-I Ignores first block in the alignment
-L Clean-up the alignment before running ClonalFrame
-l Minimum distance between two reference sites (default is 50)
-v Verbose mode
AUTHOR
ClonalFrame was written by Xavier Didelot.
This manual page was written by Andreas Tille <tille@debian.org>, for the Debian project (but may be used by others).
February 2011 1.2 ClonalFrame(1)