Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Perl Script to delete record if it exceeds 199 fields Post 302564410 by Perlbaby on Thursday 13th of October 2011 02:49:37 PM
Old 10-13-2011
Perl Script to delete record if it exceeds 199 fields

HI All,
I am new to perl ,need your inputs for my better understanding.

I have 5 UNIX files ,inside which only required fields will be loaded except with junk data mentioned in double quotes .For Ex

File has below information:
Process=High
Name=Albert
Age=27
Occupation=Army
"Medlife Cont'd Capital partnership 12.36 Cont'd Sillicon valley Cont'd Global management overseas....................................................................
...........................Cont'd traditional quora etc....."

Fields starting with " " , wont be loaded as its invalid .Also has more than 199 fields which pops up inbetween correct records.When i use AWK ,its throwing error due to thresold limit.I cannot upgrade HP-UX to use gwak due to constraints.

Can PERL be used to search for pattern (Say "Medlife") and take count of each file line record ,if it exceeds 199 fields.It should delete that record and new file should be generated.

Please help me on this regard .





Constraints :
I cannot upgrade HP-UX to use gwak.Please advice how should i
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk: record has too many fields

Hi, I'm trying this command - but get this error. Do you guys have any workaround for this? cat tf|sed 's/{//g'|sed 's/,//g'|awk '{for (i=1;i<=NF;i++) {if ($i == "OPTIME") {k = i + 2; print $i,$k}}}' awk: record `2005 Jul 28 17:35:29...' has too many fields record number 15 This is how... (3 Replies)
Discussion started by: chaandana
3 Replies

2. Shell Programming and Scripting

How count number of fields in a record

Dear All , I have the query cat temp.txt |28-07-1997|IF_LEG_DCCT|TOV JV sdfsdfdsfdsfdsCLOSED* KIEV|381015280 I need to count the number of fields in this pipe-seperated file. I beleive this is possible via AWK command. The in above file, output of the count should be 5.... Can some-one... (5 Replies)
Discussion started by: sureshg_sampat
5 Replies

3. Shell Programming and Scripting

Making changes in the fields of a record

:confused: Hi Friends, In the record below i have to make changes in the fields by putting the values stored in the temporary variables, x, y, z, p, q, r: 2) In the TBT record store the values in the various fields as: a) X in a field position 51 to 56 b) Y... (5 Replies)
Discussion started by: kanu_pathak
5 Replies

4. Shell Programming and Scripting

Shell script for searching a record,copy to a file and then delete it

Hi, I have a requirement in hand: I have a file with millions of records say file 1.I have another file, say file 2 which has 2000 records in it. The requirement is to read file2 , and remove the read record from file 1 and move i to a seperate file, file 3. For eg: Read file 2, get the... (5 Replies)
Discussion started by: kumara2010
5 Replies

5. Shell Programming and Scripting

Print all the fields of record using awk

Hi, i want to generate print statement using awk. i have 20+ and 30+ fields in each line Now its priting only first eight fields print statement as output not all. my record is as shown below filename ... (2 Replies)
Discussion started by: raghavendra.nsn
2 Replies

6. Linux

perl program to delete the complete record

Hi all, I want a perl program to delete the record and its contents from a file if there is no particular line in the record given that all records are separated by a blank line. For example: #100 abcd efgh hijk 123 klm #200 abcd efgh hijk klm So, the pattern here is 123. If... (0 Replies)
Discussion started by: kaav06
0 Replies

7. UNIX for Dummies Questions & Answers

To delete the oldest files in a file when file count in the folder exceeds 7

Hi All, I need to delete the oldest file in folder when the file count in the folder exceed 6 ( i have a process that puts the source files into this folder ) E.x : Folder : /data/opt/backup 01/01/2012 a.txt 01/02/2012 b.txt ... (1 Reply)
Discussion started by: akshay01987
1 Replies

8. Shell Programming and Scripting

Compare fields and keep record with bigger ID?

How do you write a shell script to compare records with the same fields then keep the biggeer id number fields (field separate by a pipe) 1150| San Jose|8|15|7|2013-02-19 00:00:00.000|2013-02-20 00:00:00.000 1263|San Jose|8|15|7|2013-02-19 00:00:00.000|2013-02-20 00:00:00.000... (4 Replies)
Discussion started by: sabercats
4 Replies

9. Shell Programming and Scripting

Delete last 2 fields from every record in a file

Sample file record : "20130617003","2013-06-18T07:00:03","OUTWARD","01001011","TEST PLC","","HFX834346364364","20130617","10","DUM87534758","","1.28","826","020201","65879278","","","","","","010101","56789","DUMMY... (3 Replies)
Discussion started by: bigbuk
3 Replies

10. Shell Programming and Scripting

awk - compare 1st 15 fields of record with 20 fields

I'm trying to compare 2 files for differences in a selct number of fields. When differnces are found it will write the whole record of the second file including appending '|C' out to a delta file. Each record will have 20 fields, but only want to do comparison of 1st 15 fields. The 1st field of... (7 Replies)
Discussion started by: sljnk
7 Replies
pddump(1)						      General Commands Manual							 pddump(1)

NAME
pddump - Dump profiling data files SYNOPSIS
pddump file... OPERANDS
A data file generated by a profiled program. A valid file is identified as a "profiling data file" by the file(1) command. DESCRIPTION
The pddump command displays, on the standard output, the record definitions and data of the specified profiling data files. Each file's dump is prefixed by the line "File = file:". This is followed by the file's field-alignment option and a list containing the file's name/value attribute pairs and the file's record definitions. Then each record in the file is dumped, showing the name of the record and the name and value of each of its fields. Strings are printed within double quotes, unsigned integers are printed in hexadecimal, and signed integers and floating-point numbers are printed in decimal. Non-array data lines contain equal signs to assist in filtering. The content of the profiling data files produced by Tru64 UNIX may be expanded in future releases, but Tru64 UNIX tools will continue to support older formats. To write tools that process Tru64 UNIX profiling data files, use the pdtostd(1) command to convert the Tru64 UNIX formats to industry standard formats, where a standard format exists. Alternatively, use the libpdf.a utilities to read the profiling data files directly, skipping any new attributes, records, or fields that may appear. FILES
Library of routines for reading and writing profiling data files Header file for libpdf.a SEE ALSO
Commands: atom(1), cc(1), file(1), kprofile(1), pdtostd(1), uprofile(1) AtomTools: hiprof(5), pixie(5) Programmer's Guide pddump(1)
All times are GMT -4. The time now is 02:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy