Sponsored Content
Top Forums Shell Programming and Scripting Find line number of bad data in large file Post 302488002 by joeyg on Friday 14th of January 2011 12:02:00 PM
Old 01-14-2011
Tools See a previous posting

Take a look at this similar request:
https://www.unix.com/shell-programmin...ect-lines.html
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Problem using find with prune on large number of files

Hi all; I'm having a problem when want to list a large number of files in current directory using find together with the prune option. First i used this command but it list all the files including those in sub directories: find . -name "*.dat" | xargs ls -ltr Then i modified the command... (2 Replies)
Discussion started by: ashikin_8119
2 Replies

2. Shell Programming and Scripting

how to get the data from line number 1 to line number 100 of a file

Hi Everybody, I am trying to write a script that will get some perticuler data from a file and redirect to a file. My Question is, I have a Very huge file,In that file I have my required data is started from 25th line and it will ends in 100th line. I know the line numbers, I need to get all... (9 Replies)
Discussion started by: Anji
9 Replies

3. Solaris

Bad File Number

System Solaris 8 When I open a CONSOLE window the following starts scrolling: "ServiceCommand: :write: Bad FIle Number" This will continue to scroll without stopping. However, you can type while it is scrolling and login into root and even conduct business within the CONSOLE window. The... (1 Reply)
Discussion started by: Kevin1166
1 Replies

4. Programming

Suitable data structure large number of heterogeneous records

Hi All, I don't need any code for this just some advice. I have a large collection of heterogeneous data (about 1.3 million) which simply means data of different types like float, long double, string, ints. I have built a linked list for it and stored all the different data types in a structure,... (5 Replies)
Discussion started by: shoaibjameel123
5 Replies

5. Shell Programming and Scripting

Using find in a directory containing large number of files

Hi All, I have searched this forum for related posts but could not find one that fits mine. I have a shell script which removes all the XML tags including the text inside the tags from some 4 million XML files. The shell script looks like this (MODIFIED): find . "*.xml" -print | while read... (6 Replies)
Discussion started by: shoaibjameel123
6 Replies

6. Shell Programming and Scripting

find string nth occurrence in file and print line number

Hi I have requirement to find nth occurrence in a file and capture data from with in lines (between lines) Data in File. <QUOTE> <SESSION> <ATTRIBUTE NAME='Parameter Filename' VALUE='file1.parm'/> <ATTRIBUTE NAME='Service Name' VALUE='None'/> </SESSION> <SESSION> <ATTRIBUTE... (6 Replies)
Discussion started by: tmalik79
6 Replies

7. Shell Programming and Scripting

How to remove a subset of data from a large dataset based on values on one line

Hello. I was wondering if anyone could help. I have a file containing a large table in the format: marker1 marker2 marker3 marker4 position1 position2 position3 position4 genotype1 genotype2 genotype3 genotype4 with marker being a name, position a numeric... (2 Replies)
Discussion started by: davegen
2 Replies

8. Shell Programming and Scripting

awk to find number in a field then print the line and the number

Hi I want to use awk to match where field 3 contains a number within string - then print the line and just the number as a new field. The source file is pipe delimited and looks something like 1|net|ABC Letr1|1530||| 1|net|EXP_1040 ABC|1121||| 1|net|EXP_TG1224|1122||| 1|net|R_North|1123|||... (5 Replies)
Discussion started by: Mudshark
5 Replies

9. Shell Programming and Scripting

Reoccuring peak values in large data file and print the line..

Hi i have some large data files that contain several fields and rows the data in a field have a numeric value that is in a sine wave pattern what i would like todo is locate each peak and pick the highest value and print that complete line. the data looks something like this it is field nr4 which... (4 Replies)
Discussion started by: ninjaunx
4 Replies

10. Shell Programming and Scripting

Find Data in test file and write each out to a line

I have a .csv file that has been create from a google form and I need to extract the data from it that has been entered by users. The CSV will have anywhere between 100 and 1000 lines which comprise entr data for a sports carnival A few typical line is shown here to show the problem I have ... (19 Replies)
Discussion started by: kcpoole
19 Replies
Bad(3)							User Contributed Perl Documentation						    Bad(3)

NAME
PDL::Bad - PDL does process bad values DESCRIPTION
PDL has been compiled with WITH_BADVAL set to 1. Therefore, you can enter the wonderful world of bad value support in PDL. This module is loaded when you do "use PDL", "Use PDL::Lite" or "PDL::LiteF". Implementation details are given in PDL::BadValues. SYNOPSIS
use PDL::Bad; print " Bad value support in PDL is turned " . $PDL::Bad::Status ? "on" : "off" . ". "; Bad value support in PDL is turned on. and some other things VARIABLES
There are currently three variables that this module defines which may be of use. $PDL::Bad::Status Set to 1 $PDL::Bad::UseNaN Set to 1 if PDL was compiled with "BADVAL_USENAN" set, 0 otherwise. $PDL::Bad::PerPdl Set to 1 if PDL was compiled with the experimental "BADVAL_PER_PDL" option set, 0 otherwise. FUNCTIONS
badflag switch on/off/examine bad data flag if ( $a->badflag() ) { print "Data may contain bad values. "; } $a->badflag(1); # set bad data flag $a->badflag(0); # unset bad data flag A return value of 1 does not guarantee the presence of bad data in a piddle; all it does is say that we need to check for the presence of such beasties. To actually find out if there are any bad values present in a piddle, use the check_badflag method. Does support bad values. badvalue returns the value used to indicate a missing (or bad) element for the given piddle type. You can give it a piddle, a PDL::Type object, or one of $PDL_B, $PDL_S, etc. $badval = badvalue( float ); $a = ones(ushort,10); print "The bad data value for ushort is: ", $a->badvalue(), " "; If a new value is supplied via a piddle (e.g. "$a->badvalue(23)"), then the data in the supplied piddle is converted to use the new bad value as well if the data type is an integer or "$PDL::Bad::UseNaN == 0". Currently there is no way of automatically converting the bad values of already existing piddles. This could be supported - e.g. by having a per-piddle bad value or by storing a time index in the piddle structure - if required. If the $PDL::Bad::PerPdl flag is set then it is possible to change the bad value on a per-piddle basis, so $a = sequence(10); $a->badvalue(3); $a->badflag(1); $b = sequence(10); $b->badvalue(4); $b->badflag(1); will set $a to be "[0 1 2 BAD 4 5 6 7 8 9]" and $b to be "[0 1 2 3 BAD 5 6 7 8 9]". If the flag is not set then both $a and $b will be set to "[0 1 2 3 BAD 5 6 7 8 9]". Please note that the code to support per-piddle bad values is experimental in the current release. Does support bad values. orig_badvalue returns the original value used to represent bad values for a given type. This routine operates the same as badvalue, except you can not change the values. It also has an awful name. $orig_badval = orig_badvalue( float ); $a = ones(ushort,10); print "The original bad data value for ushort is: ", $a->orig_badvalue(), " "; Does support bad values. check_badflag clear the bad-value flag of a piddle if it does not contain any bad values Given a piddle whose bad flag is set, check whether it actually contains any bad values and, if not, clear the flag. It returns the final state of the bad-value flag. print "State of bad flag == ", $pdl->check_badflag; Does support bad values. isbad Signature: (a(); int [o]b()) Is a value bad? Returns a 1 if the value is bad, 0 otherwise. Also see isfinite. $a = pdl(1,2,3); $a->badflag(1); set($a,1,$a->badvalue); $b = isbad($a); print $b, " "; [0 1 0] isbad does handle bad values. The output piddles will NOT have their bad-value flag set. isgood Signature: (a(); int [o]b()) Is a value good? Returns a 1 if the value is good, 0 otherwise. Also see isfinite. $a = pdl(1,2,3); $a->badflag(1); set($a,1,$a->badvalue); $b = isgood($a); print $b, " "; [1 0 1] isgood does handle bad values. The output piddles will NOT have their bad-value flag set. nbadover Signature: (a(n); int+ [o]b()) Find the number of bad elements along the 1st dimension. This function reduces the dimensionality of a piddle by one by finding the number of bad elements along the 1st dimension. By using xchg etc. it is possible to use any dimension. $a = nbadover($b); $spectrum = nbadover $image->xchg(0,1) nbadover does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. ngoodover Signature: (a(n); int+ [o]b()) Find the number of good elements along the 1st dimension. This function reduces the dimensionality of a piddle by one by finding the number of good elements along the 1st dimension. By using xchg etc. it is possible to use any dimension. $a = ngoodover($b); $spectrum = ngoodover $image->xchg(0,1) ngoodover does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. nbad Returns the number of bad values in a piddle $x = nbad($data); Does support bad values. ngood Returns the number of good values in a piddle $x = ngood($data); Does support bad values. setbadat Set the value to bad at a given position. setbadat $piddle, @position @position is a coordinate list, of size equal to the number of dimensions in the piddle. This is a wrapper around set and is probably mainly useful in test scripts! perldl> $x = sequence 3,4 perldl> $x->setbadat 2,1 perldl> p $x [ [ 0 1 2] [ 3 4 BAD] [ 6 7 8] [ 9 10 11] ] Supports badvalues. setbadif Signature: (a(); int mask(); [o]b()) Set elements bad based on the supplied mask, otherwise copy across the data. $a = sequence(5,5); $a = $a->setbadif( $a % 2 ); print "a badflag: ", $a->badflag, " "; a badflag: 1 Unfortunately, this routine can not be run inplace, since the current implementation can not handle the same piddle used as "a" and "mask" (eg "$a->inplace->setbadif($a%2)" fails). Also see setvaltobad and setnantobad. The output always has its bad flag set, even if it does not contain any bad values (use check_badflag to check whether there are any bad values in the output). Any bad values in the input piddles are copied across to the output piddle. setvaltobad Signature: (a(); [o]b(); double value) Set bad all those elements which equal the supplied value. $a = sequence(10) % 3; $a->inplace->setvaltobad( 0 ); print "$a "; [BAD 1 2 BAD 1 2 BAD 1 2 BAD] This is a simpler version of setbadif, but this function can be done inplace. See setnantobad if you want to convert NaN/Inf to the bad value. The output always has its bad flag set, even if it does not contain any bad values (use check_badflag to check whether there are any bad values in the output). Any bad values in the input piddles are copied across to the output piddle. setnantobad Signature: (a(); [o]b()) Sets NaN/Inf values in the input piddle bad (only relevant for floating-point piddles). Can be done inplace. $b = $a->setnantobad; $a->inplace->setnantobad; Supports bad values. setbadtonan Signature: (a(); [o]b()) Sets Bad values to NaN (only relevant for floating-point piddles). Can be done inplace and it clears the bad flag. $b = $a->setbadtonan; $a->inplace->setbadtonan; Supports bad values. setbadtoval Signature: (a(); [o]b(); double newval) Replace any bad values by a (non-bad) value. Can be done inplace. Also see badmask. $a->inplace->setbadtoval(23); print "a badflag: ", $a->badflag, " "; a badflag: 0 The output always has its bad flag cleared. If the input piddle does not have its bad flag set, then values are copied with no replacement. copybad Signature: (a(); mask(); [o]b()) Copies values from one piddle to another, setting them bad if they are bad in the supplied mask. Can be done inplace. $a = byte( [0,1,3] ); $mask = byte( [0,0,0] ); set($mask,1,$mask->badvalue); $a->inplace->copybad( $mask ); p $a; [0 BAD 3] It is equivalent to: $c = $a + $mask * 0 Handles bad values. CHANGES
The experimental "BADVAL_PER_PDL" configuration option, which - when set - allows per-piddle bad values, was added after the 2.4.2 release of PDL. The "" variable can be inspected to see if this feature is available. AUTHOR
Doug Burke (djburke@cpan.org), 2000, 2001, 2003, 2006. The per-piddle bad value support is by Heiko Klein(2006). All rights reserved. There is no warranty. You are allowed to redistribute this software / documentation under certain conditions. For details, see the file COPYING in the PDL distribution. If this file is separated from the PDL distribution, the copyright notice should be included in the file. perl v5.12.1 2010-07-05 Bad(3)
All times are GMT -4. The time now is 01:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy