Sponsored Content
Top Forums Shell Programming and Scripting Grab contents between two patterns Post 302840559 by Jotne on Tuesday 6th of August 2013 02:43:25 AM
Old 08-06-2013
This does not include start and stop words
Code:
awk '/Changes/{f=1;next} /Dependencies/{f=0} f' file

This includes start and stop word
Code:
awk '/Changes/,/Dependencies/' file
awk '/Changes/{f=1} /Dependencies/{f=0;print} f' file

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Searching patterns in 1 file and deleting all lines with those patterns in 2nd file

Hi Gurus, I have a file say for ex. file1 which has 3500 lines in it which are different account numbers and another file (file2) which has 230000 lines in it. I want to read all the lines in file1 and delete all those lines from file2 which has that same pattern as in file1. I am not quite... (4 Replies)
Discussion started by: toms
4 Replies

2. Programming

Need to modify contents of file with complex patterns.

hi, my fstab file content is like this along with some other lines: /dev/vg0/var1 /var1 ext3 defaults 0 2 /dev/vg0/flx1 /flx1 ext3 defaults 0 2 /dev/vg0/var /var ext3 defaults 0 1 /dev/vg0/flx /flx ext3 defaults 0 2 I want to remove lines with /dev/vg0/var and... (5 Replies)
Discussion started by: success
5 Replies

3. Shell Programming and Scripting

Grab the return value of df -H-m

Hi to everyone :) Quick question how do i grab the return value on the 5 position here : sgs@sibs:~$ df -H -m Sist.fichs 1M-blocos Used Available Use% Mounted on /dev/sda1 35542 18904 14833 57% / In this case the Use% value . I need to... (9 Replies)
Discussion started by: drd0spt
9 Replies

4. Shell Programming and Scripting

Grab contents between two matched patterns

I am wanting to fetch the content of the table within a file the table begins with data label like N Batch Mn(I) RMSdev I/rms Rmerge Number Nrej Cm%poss AnoCmp MaxRes CMlplc SmRmerge SmMaxRes $$ $$ . #columns of data . . . . . $$ I tried the command awk... (18 Replies)
Discussion started by: piynik
18 Replies

5. Shell Programming and Scripting

Folder contents getting appended as strings while redirecting file contents to a variable

Hi one of the output of the command is as below # sed -n "/CCM-ResourceHealthCheck:/,/---------/{/CCM-ResourceHealthCheck:/d;/---------/d;p;}" Automation.OutputZ$zoneCounter | sed 's/$/<br>/' Resource List : <br> *************************** 1. row ***************************<br> ... (2 Replies)
Discussion started by: vivek d r
2 Replies

6. Shell Programming and Scripting

Grab the contents with in special character

I have a file which contains below kind of lines 2013-05-21 00:00:03 INFO moved to unprocessed, as doesn't exist in masklist and modified at 2013-05-20@21:21:21.000000000. 2013-05-21 00:00:03 INFO moved to unprocessed, as doesn't exist in masklist and modified at... (1 Reply)
Discussion started by: manas_ranjan
1 Replies

7. Shell Programming and Scripting

Grab nth occurence in between two patterns using awk or sed

Hi , I have an issue where I want to parse through the output from a file and I want to grab the nth occurrence of text in between two patterns preferably using awk or sed ! TICKET NBR : 1 !GSI : 102 ! 3100.2.112.1 11/06/2013 15:56:29 ! 3100.2.22.3 98 ! 3100.2.134.2... (8 Replies)
Discussion started by: OTNA
8 Replies

8. Shell Programming and Scripting

Find matched patterns and print them with other patterns not the whole line

Hi, I am trying to extract some patterns from a line. The input file is space delimited and i could not use column to get value after "IN" or "OUT" patterns as there could be multiple white spaces before the next digits that i need to print in the output file . I need to print 3 patterns in a... (3 Replies)
Discussion started by: redse171
3 Replies

9. Shell Programming and Scripting

If contents of A are in B then move the common contents to C

Hallo Team, I have 2 .csv files file A has 47600 lines and file B has 67000 lines FILEA SD0o9rb01-1d320ddbcc8d220f572739ebed5f58d1-v300g00 SD8bt0101-a0810bfe0e3396060126ec51b30dac0a-v300g00 SD05sce01-cb056af347ed4651f29eb3c3e9addbd6-v300g00... (3 Replies)
Discussion started by: kekanap
3 Replies

10. Shell Programming and Scripting

Bash - Find files excluding file patterns and subfolder patterns

Hello. For a given folder, I want to select any files find $PATH1 -f \( -name "*" but omit any files like pattern name ! -iname "*.jpg" ! -iname "*.xsession*" ..... \) and also omit any subfolder like pattern name -type d \( -name "/etc/gconf/gconf.*" -o -name "*cache*" -o -name "*Cache*" -o... (2 Replies)
Discussion started by: jcdole
2 Replies
Debian::Dependencies(3pm)				User Contributed Perl Documentation				 Debian::Dependencies(3pm)

NAME
Debian::Dependencies - a list of Debian::Dependency objects SYNOPSIS
my $dl = Debian::Dependencies->new('perl, libfoo-perl (>= 3.4)'); print $dl->[1]->ver; # 3.4 print $dl->[1]; # libfoo-perl (>= 3.4) print $dl; # perl, libfoo-perl (>= 3.4) $dl += 'libbar-perl'; print $dl; # perl, libfoo-perl (>= 3.4), libbar-perl print Debian::Dependencies->new('perl') + 'libfoo-bar-perl'; # simple 'sum' print Debian::Dependencies->new('perl') + Debian::Dependencies->new('libfoo, libbar'); # add (concatenate) two lists print Debian::Dependencies->new('perl') + Debian::Dependency->new('foo'); # add depeendency to a list DESCRIPTION
Debian::Dependencies a list of Debian::Dependency objects, with automatic construction and stringification. Objects of this class are blessed array references. You can safely treat them as arrayrefs, as long as the elements you put in them are instances of the Debian::Dependency class. When used in string context, Debian::Dependencies converts itself into a comma-delimitted list of dependencies, suitable for dependency fields of debian/control files. CLASS METHODS new(dependency-string) Constructs a new Debian::Dependencies object. Accepts one scalar argument, which is parsed and turned into an arrayref of Debian::Dependency objects. Each dependency should be delimitted by a comma and optional space. The exact regular expression is "/s*,s*/". OBJECT METHODS add( dependency[, ... ] ) Adds dependency (or a list of) to the list of dependencies. If the new dependency is a subset of or overlaps some of the old dependencies, it is not duplicated. my $d = Debian::Dependencies('foo, bar (<=4)'); $d->add('foo (>= 4), bar'); print "$d"; # foo (>= 4), bar (>= 4) dependency can be either a Debian::Dependency object, a Debian::Deendencies object, or a string (in which case it is converted to an instance of the Debian::Dependencies class). remove( dependency, ... ) =item remove( dependencies, ... ) Removes a dependency from the list of dependencies. Instances of Debian::Dependency and Debian::Dependencies classes are supported as arguments. Any non-reference arguments are coerced to instances of Debian::Dependencies class. Only dependencies that are subset of the given dependencies are removed: my $deps = Debian::Dependencies->new('foo (>= 1.2), bar'); $deps->remove('foo, bar (>= 2.0)'); print $deps; # bar Returns the list of the dependencies removed. has( dep ) Return true if the dependency list contains given dependency. In other words, this returns true if the list of dependencies guarantees that the given dependency will be satisfied. For example, "foo, bar" satisfies "foo", but not "foo (>= 5)". prune() This method is deprecated. If you want to sort the dependency list, either call "sort" or use normal perl sorting stuff on the dereferenced array. sort() Sorts the dependency list by packagee name, version and relation. SEE ALSO
Debian::Dependency AUTHOR
Damyan Ivanov <dmn@debian.org> COPYRIGHT &; LICENSE Copyright (C) 2008, 2009, 2010 Damyan Ivanov <dmn@debian.org> Copyright (C) 2009 gregor herrmann <gregoa@debian.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. perl v5.14.2 2012-01-15 Debian::Dependencies(3pm)
All times are GMT -4. The time now is 03:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy