Sponsored Content
Top Forums Shell Programming and Scripting validating data in columns and writing them to new file Post 302720241 by msabhi on Tuesday 23rd of October 2012 04:22:15 PM
Old 10-23-2012
Code:
perl -F"" -alne '{($F[30]." ".$F[31])==("X T")?print:next;}' input_file

This User Gave Thanks to msabhi For This Post:
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

validating data

I have a file like the following aaaaa00005bbbbb aaaaa00108bbbbb The code "00005" and "00108" need to be validated and the list of valid codes are stored in a database. While I loop through the file, should call a sql statement for every records to do the validation? or is... (1 Reply)
Discussion started by: joanneho
1 Replies

2. UNIX for Dummies Questions & Answers

Validating XSL sheet data in Unix Data file

Dear All, Need your help. In my day to day activities I have to validate/search Excel Sheet data (eg.say Application No. 0066782345) data into the Unix environment file whether the same data is present in that file or not. There are hundreds of records coming in excel file and I am doing grep... (1 Reply)
Discussion started by: ravijunghare
1 Replies

3. Shell Programming and Scripting

AWK Help- Writing Data into a File

Hi All, I need to maintain a AUDIT file in system for every incoming and outgoing file. For this i am trying to append a record by using the AWK every time the file arriving. I have used the code as below. AWK '{print "FILENAME IS", $1,"DATE IS", $2}' >> AUDITFILE.txt $1 and $2 are global... (1 Reply)
Discussion started by: Raamc
1 Replies

4. Programming

writing binary/struct data to file

I am trying to write binary data to a file. My program below: #include <stdlib.h> #include <stdio.h> struct tinner { int j; int k; }; struct touter { int i; struct tinner *inner; }; int main() { struct touter data; data.i = 10; struct tinner... (4 Replies)
Discussion started by: radiatejava
4 Replies

5. Shell Programming and Scripting

Problem in writing the data to a file in one row

Hi All I am reading data from the database and writing to temporary file in the below format. 1=XP|external_component|com.adp.meetingalertemail.processing.MeetingAlertEmail|EMAILALERTPUSH|32|4#XP |classpath|/usr/home/dfusr/lib/xalan.jar: /usr/home/dfusr/lib/xerces.jar: ... (2 Replies)
Discussion started by: rajeshorpu
2 Replies

6. Shell Programming and Scripting

Comparing Columns and writing a new file

I have a table with one column File1.txt 1 2 3 4 5 6 7 8 9 10 Another table with two columns; This has got a subset of entries from File 1 but not unique because they have differing values in col 2. File2.txt 1 a 2 d 2 f 6 r 6 e (3 Replies)
Discussion started by: cs_novice
3 Replies

7. Shell Programming and Scripting

Writing input data in file

I am having an input file for eg. file.txt which contains pipe delimited rows file.txt: xx|yyy|zz|12|3|aaaaa|..... yy|zz|1|3|4|xxxxx|....... . . . i want the above file name to be transformed into another file with giving input from the user and replacing the corresponding fields based... (5 Replies)
Discussion started by: rohit_shinez
5 Replies

8. Shell Programming and Scripting

awk error - validating strings in columns

can someone please help me fix this command: somecommand.sh | awk -F"---" 'BEGIN{count=0} /P/ && /ERROR/ {if (($3 ~ /^P$/) && ($6 ~ /ERROR/)) {print; count++ }END { print count } ;}' basically, what i'm attempting to do here is print all the matching lines, then, at the end, print the total... (2 Replies)
Discussion started by: SkySmart
2 Replies

9. Shell Programming and Scripting

Writing output to a file in columns

Hi I am trying to write output to a file in columns I have file in the follwoing: # cat file abc def # I am trying to write next output as like # cat file abc 123 def 345 # :mad: (6 Replies)
Discussion started by: Priya Amaresh
6 Replies
Devel::Refcount(3pm)					User Contributed Perl Documentation				      Devel::Refcount(3pm)

NAME
"Devel::Refcount" - obtain the REFCNT value of a referent SYNOPSIS
use Devel::Refcount qw( refcount ); my $anon = []; print "Anon ARRAY $anon has " . refcount($anon) . " reference "; my $otherref = $anon; print "Anon ARRAY $anon now has " . refcount($anon) . " references "; DESCRIPTION
This module provides a single function which obtains the reference count of the object being pointed to by the passed reference value. FUNCTIONS
$count = refcount($ref) Returns the reference count of the object being pointed to by $ref. COMPARISON WITH SvREFCNT This function differs from "Devel::Peek::SvREFCNT" in that SvREFCNT() gives the reference count of the SV object itself that it is passed, whereas refcount() gives the count of the object being pointed to. This allows it to give the count of any referent (i.e. ARRAY, HASH, CODE, GLOB and Regexp types) as well. Consider the following example program: use Devel::Peek qw( SvREFCNT ); use Devel::Refcount qw( refcount ); sub printcount { my $name = shift; printf "%30s has SvREFCNT=%d, refcount=%d ", $name, SvREFCNT($_[0]), refcount($_[0]); } my $var = []; printcount 'Initially, $var', $var; my $othervar = $var; printcount 'Before CODE ref, $var', $var; printcount '$othervar', $othervar; my $code = sub { undef $var }; printcount 'After CODE ref, $var', $var; printcount '$othervar', $othervar; This produces the output Initially, $var has SvREFCNT=1, refcount=1 Before CODE ref, $var has SvREFCNT=1, refcount=2 $othervar has SvREFCNT=1, refcount=2 After CODE ref, $var has SvREFCNT=2, refcount=2 $othervar has SvREFCNT=1, refcount=2 Here, we see that SvREFCNT() counts the number of references to the SV object passed in as the scalar value - the $var or $othervar respectively, whereas refcount() counts the number of reference values that point to the referent object - the anonymous ARRAY in this case. Before the CODE reference is constructed, both $var and $othervar have SvREFCNT() of 1, as they exist only in the current lexical pad. The anonymous ARRAY has a refcount() of 2, because both $var and $othervar store a reference to it. After the CODE reference is constructed, the $var variable now has an SvREFCNT() of 2, because it also appears in the lexical pad for the new anonymous CODE block. PURE-PERL FALLBACK An XS implementation of this function is provided, and is used by default. If the XS library cannot be loaded, a fallback implementation in pure perl using the "B" module is used instead. This will behave identically, but is much slower. Rate pp xs pp 225985/s -- -66% xs 669570/s 196% -- SEE ALSO
o Test::Refcount - assert reference counts on objects AUTHOR
Paul Evans <leonerd@leonerd.org.uk> perl v5.14.2 2011-11-15 Devel::Refcount(3pm)
All times are GMT -4. The time now is 12:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy