Sponsored Content
Top Forums Shell Programming and Scripting Omitting sections of file that contain word Post 302708949 by Corona688 on Tuesday 2nd of October 2012 12:19:13 PM
Old 10-02-2012
That is a useless use of cat. awk, or any other shell command, does not need cat's help to read a single file.

If you set awk's record separator to blank, it will take blank lines to be the separators between records here:

Code:
awk -v RS="" -F"\n" '{ P=1
        for(N=1; N<=NF; N++) if($N ~ /hostgroup_name[ \t]*$/) P=0 } P' inputfile

This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

omitting lines from file A that are in file B

I've got file A with (say) 1M lines in it ... ascii text, space delimited ... I've got file B with (say) 10M lines in it ... same structure. I want to remove any lines from A that appear (identically) in B and print the remaining (say) 900K lines. (And I want to do it in zero time of... (14 Replies)
Discussion started by: gneen
14 Replies

2. UNIX for Advanced & Expert Users

extract multiple sections of a file

I have a file that I need to parse multiple sections from the file. The file contains multiple lines that start with ST (Abunch of data) Then the file contains multiple lines that start with SE (Abunch of data) SE*30*0001 ... (1 Reply)
Discussion started by: rgentis
1 Replies

3. Shell Programming and Scripting

extract multiple sections of file

I have a file that I need to parse multiple sections from the file. The file contains multiple lines that start with ST (Abunch of data) Then the file contains multiple lines that start with SE (Abunch of data) SE*30*0001 ST*810*0002 I need all of the lines between and including these.... (6 Replies)
Discussion started by: rgentis
6 Replies

4. Shell Programming and Scripting

Best way to remove sections of text from a file

Greetings! I found this fourm via a google search on "sed expressions". I have a file that contains notices and they are all the same length in lines. For example the file would contains 15 notices, each being 26 lines each. I need some way to eliminate notices that contain a "S" in a particular... (8 Replies)
Discussion started by: cals64
8 Replies

5. Shell Programming and Scripting

Parsing file, yaml file? Extracting specific sections

Here is a data file, which I believe is in YAML. I am trying to retrieve just the 'addon_domains" section, which doesnt seem to be as easy as I had originally thought. Any help on this would be greatly appreciated!! I have been trying to do this in awk and mostly bash scripting instead of perl... (3 Replies)
Discussion started by: Rhije
3 Replies

6. Shell Programming and Scripting

Remove sections of a xml file with sed

I've been trying to remove some lines of a xml file that looks like this: <parent> <child>name1</child> <lots_of_other tags></lots_of_other_tags> </parent> <parent> <child>name2</child> <lots_of_other tags></lots_of_other_tags> </parent> <parent> <child>name3</child> ... (5 Replies)
Discussion started by: viniciusandre
5 Replies

7. Shell Programming and Scripting

Modify sections of the line in a file

Hello.. I have a line in a file which I have to edit: the line looks like: <!]> Sometimes, the section of the line can have only one entry for cn, or maybe more than 2 like below: <!]> I have a variable which has the following value: CN="(cn=MNO)(cn=XYZ)" I need to replace the part... (4 Replies)
Discussion started by: chiru_h
4 Replies

8. Shell Programming and Scripting

How to edit file sections that cross multiple lines?

Hello, I'm wondering where I could go to learn how to edit file sections that cross multiple lines. I'm wanting to write scripts that will add Gnome menu entries for all users on a system for scripts I write, etc. I can search an replace simple examples with sed, but this seems more complex. ... (8 Replies)
Discussion started by: Narnie
8 Replies

9. Programming

extract different sections of a file

Hi All, I have a file with the data 10;20;30;40;50;60;70;80;123;145;156;345. the output i want is the first fourth sixth elements and everything from there on. How do i achieve this. (1 Reply)
Discussion started by: raghu_shekar
1 Replies

10. Shell Programming and Scripting

awk removing sections of a file

I have a file that looks liek this (see below). can somebody provide me with and awk or sed command that can take a piece of the file starting from the time to the blank line and put in into another file. For example: How would I get the data from 10:56:11 to the blank line. Two things: ... (5 Replies)
Discussion started by: BeefStu
5 Replies
DJVUMAKE(1)							   DjVuLibre-3.5						       DJVUMAKE(1)

NAME
djvumake - Assemble DjVu image files. SYNOPSIS
djvumake djvufile [chkid=argument]... DESCRIPTION
Program djvumake assembles a single-page DjVu file djvufile by copying or creating chunks according to the provided arguments. Supported arguments are as follows: INFO=w,h,dpi Create the initial information chunk. Arguments w, h, and dpi describe the width, height and resolution of the image. All argu- ments may be omitted. The default resolution is 300 dpi. The default width and height will be retrieved from the first mask chunk specified in the command line options. Sjbz=jb2file Create a JB2 foreground mask chunk. File jb2file may contain raw JB2 data, or be a DjVu file containing JB2 data such as those pro- duced by program cjb2. Smmr=mmrfile Create a MMR/G4 foreground mask chunk. File mmrfile may contain raw MMR data or be a DjVu file containing MMR data. BG44=iw44file[:n] Create one or more IW44 background chunks. File iw44file must contain IW44 data. Such files can be obtained by compressing the background image with program c44 and extracting the raw IW44 data using program djvuextract. The optional argument n indicates the number of chunks to copy from the IW44 file. Omitting the number of chunks copies all available chunks. BGjp=jpegfile Create a JPEG encoded background chunk. File jpegfile must contain JPEG encoded data. BG2k=jpegfile Create a JPEG-2000 background chunk. File jpegfile must contain JPEG-2000 encoded data. The DjVu decoder does not yet display files containing JPEG-2000 data. FGbz=bzzfile Create a foreground color chunk describing one solid color for each JB2 encoded mark. File bzzfile is best created by extracting the chunk data from an existing DjVu file using command djvuextract. FG44=iw44file Create a IW44 foreground color chunk. File iw44file must contain IW44 data. Such files can be obtained by compressing the back- ground image with command c44 and extracting the raw IW44 data using program djvuextract. Only the first chunk is copied. FGjp=jpegfile Create a JPEG foreground color chunk. FG2k=jpegfile Create a JPEG-2000 foreground color chunk. The DjVu decoder does not yet display files containing JPEG-2000 data. INCL=fileid Create a DjVu3 include chunk pointing to the component file named fileid. The resulting file should then be included into a multi- page document using command djvm. PPM=ppmfile Create a IW44 background chunk and a IW44 foreground color chunk by masking and subsampling the PPM file ppmfile. Assume, for instance, that we have a PPM image myimage.ppm and an identically sized PBM bitonal image mymask.pbm whose black pixels indicate which pixels belong to the foreground. Such a bitonal file might have been obtained by thresholding or color-keying the PPM image. We can then produce a DjVuDocument image using the following two commands: cjb2 mymask.pbm mymask.djvu djvumake my.djvu Sjbz=mymask.djvu PPM=myimage.ppm Please refer to the DjVu specification ( http://www.djvuzone.org/djvu/djvu/djvuspec/ ) for more information about the composition of a legal DjVu image file. CREDITS
This program was written by Leon Bottou <leonb@users.sourceforge.net> and was then improved by Andrei Erofeev <andrew_erofeev@yahoo.com>, Bill Riemers <docbill@sourceforge.net> and many others. SEE ALSO
djvu(1), djvuextract(1), cjb2(1), c44(1) DjVuLibre-3.5 10/11/2001 DJVUMAKE(1)
All times are GMT -4. The time now is 01:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy