Sponsored Content
Top Forums Shell Programming and Scripting take a section of a data with conditions Post 302691787 by agama on Saturday 25th of August 2012 06:42:09 PM
Old 08-25-2012
I think this does what you might be looking for:

Code:
awk '
    $1 == "#"  { if( snarf ) print " "; snarf = 0; next; }   # turn off section capture, write a trailing blank line
    snarf || (/^201?/ && $12+0 > 3.0) { snarf = 1; print; }  # print a record from the section
    ' input >output

You said "blank line" but that seems to be a line with a lone hash (comment symbol) at the start. I assumed you wanted all lines from the 2011 line (with a value in field 12 greater than three, up to the next 'blank' line printed.
This User Gave Thanks to agama For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

parsing data for certain conditions

Hi guys, I have got this working OK but I am sure there is a more efficient/elegant way of doing it, which I hope you can help me with. It can be done in whatever is most suitable i.e perl/awk.. Any suggestions are welcome and many thanks in advance. What I require is to extract... (5 Replies)
Discussion started by: PAW
5 Replies

2. Shell Programming and Scripting

Search and Remove No data Section

Hello, I have written a script that removes duplicates within a file and places them in another report. File: ABC1 012345 header ABC2 7890-000 ABC3 012345 Content Header ABC5 593.0000 587.4800 ABC5 593.5000 587.6580 ABC5 593.5000 587.6580 ABC1 67890 header ABC2 1234-0001 ABC3... (2 Replies)
Discussion started by: petersf
2 Replies

3. Shell Programming and Scripting

Organization data based on two conditions applied problem asking...

Input file: HS04636 type header 836 7001 ID=g1 HS04636 type status 836 1017 Parent=g1.t1 HS04636 type location 966 1017 ID=g1.t1.cds;Parent=g1.t1 HS04636 type location 1818 1934 ID=g1.t1.cds;Parent=g1.t1 HS04636 type status 1818... (8 Replies)
Discussion started by: patrick87
8 Replies

4. Shell Programming and Scripting

Extract section of file based on word in section

I have a list of Servers in no particular order as follows: virtualMachines="IIBSBS IIBVICDMS01 IIBVICMA01"And I am generating some output from a pre-existing script that gives me the following (this is a sample output selection). 9/17/2010 8:00:05 PM: Normal backup using VDRBACKUPS... (2 Replies)
Discussion started by: jelloir
2 Replies

5. Shell Programming and Scripting

Prepend first line of section to each line until the next section header

I have searched in a variety of ways in a variety of places but have come up empty. I would like to prepend a portion of a section header to each following line until the next section header. I have been using sed for most things up until now but I'd go for a solution in just about anything--... (7 Replies)
Discussion started by: pagrus
7 Replies

6. Shell Programming and Scripting

split continues lines to separated section with conditions

Hello; i have a file contains N continues records. i want to split these lines to some separate sections with each lines of a section has the desired condition compared to other sections input: AZR ? ? ? Pn 37.202 48.82 1136119044 1136119009 SHB ? ? ? Pn 37.802 48.02 1136119047 1136119008... (4 Replies)
Discussion started by: saeed.soltani
4 Replies

7. Shell Programming and Scripting

Errors in if conditions with to many OR conditions

Hi ALL I have a script where in i need to check for several values in if conditons but when i execute the script it throws error such as "TOO MANY ARGUMENTS" if then msg="BM VAR Issue :: bmaRequestVAR=$bmaRequestVAR , nltBMVAR=$nltBMVAR , bmaResponseVAR=$bmaResponseVAR ,... (10 Replies)
Discussion started by: nikhil jain
10 Replies

8. Shell Programming and Scripting

Getting last section of data from logfile

Hi, I have a log file from Munin like this:2012/12/04 13:45:31 : Munin-update finished (29.68 sec) 2012/12/04 13:50:01 Opened log file 2012/12/04 13:50:01 : Starting munin-update 2012/12/04 13:50:01 Error occured in under in the configuration. 2012/12/04 13:50:01 Could not parse datafile... (9 Replies)
Discussion started by: Jotne
9 Replies

9. UNIX for Dummies Questions & Answers

Shell script to extract data from csv file based on certain conditions

Hi Guys, I am new to shell script.I need your help to write a shell script. I need to write a shell script to extract data from a .csv file where columns are ',' separated. The file has 5 columns having values say column 1,column 2.....column 5 as below along with their valuesm.... (1 Reply)
Discussion started by: Vivekit82
1 Replies

10. UNIX for Beginners Questions & Answers

Grep a section from an UNIX file obtaining only part of the data

Hello, I have a log file that has several sections "BEGIN JOB, End of job" like in the following example: 19/06/12 - 16:00:57 (27787398-449294): BEGIN JOB j1(27787398-449294) JOB1 19/06/12 - 16:00:57 (27787398-449294): DIGIT: 0 number of present logs : 1 19/06/12 - 16:00:57... (4 Replies)
Discussion started by: mvalonso
4 Replies
CHAR(1) 						      General Commands Manual							   CHAR(1)

NAME
char, 1/2char, rschar - browse the Unicode Standard SYNOPSIS
char [ font ] 1/2char [ -s file ] [ font ] rschar [ -bgj ] [ -s file ] [ font ] DESCRIPTION
Char displays two square arrays of characters on the screen. The left square shows the first character of each 256-character page of the Unicode Standard. The right square shows the contents of one page. Using button 1 or 2 to select a character in the left square changes the right square to display the corresponding page and displays the offset and name of the page in the upper left corner of the screen. Selecting a character in the right square displays its hexadecimal value and name. In addition, any characters selected with button 2 are added to the end of 81/2's snarf buffer. Button 3 pops up a menu containing an exit button, whose selection must be confirmed by pressing button 3 again and a clear snarf button that empties the snarf buffer. The optional argument indicates which font to use (default $font). 1/2char is intended for a smaller window and displays only a single 256-character panel. Clicking button 1 on a character displays its code and, if possible, description; button 2 works similarly, but also writes the character to file, default /dev/snarf (81/2's snarf buf- fer), which it displays near the bottom of the window. Clicking button 3 selects the page corresponding to the cursor position in the panel. Typed characters are added to the file, except: backspace deletes the last character; control-U clears the buffer; control-D exits. Rschar is the radical/stroke chart from Volume 2 of the Unicode Standard. Flags can be used to restrict the display to one or more Asian character sets: -b Big Five (traditional Chinese). -g GB 2312-80 (simplified Chinese). -j JIS X 0208-1990 (Japanese). By default, all characters are shown. Button 3 controls a menu to change flag selections. Radicals are shown in a panel on the left side of the window. Clicking on a radical with button 1 or 2 brings up, on the right, a panel of characters ordered by stroke count. If the window is too small to contain them all, one may scroll through successive panels by clicking on arrows that appear at the top. Clicking on a character with button 1 displays its code; clicking with button 2 adds the character to the snarf buffer. Typed characters behave as in 1/2char. FILES
/lib/unicode contains the names of the unicode characters. Many characters have no name. SOURCE
/sys/src/cmd/char.c /sys/src/cmd/1/2char.c /sys/src/cmd/rschar SEE ALSO
81/2(1), 81/2(4) BUGS
Char needs a largish window to work properly and doesn't complain if it doesn't get it. CHAR(1)
All times are GMT -4. The time now is 07:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy