Sponsored Content
Top Forums Shell Programming and Scripting awk - compare 1st 15 fields of record with 20 fields Post 302865819 by sljnk on Sunday 20th of October 2013 01:57:07 AM
Old 10-20-2013
mjf, thank you for your help. It is working great for all my test files/scenarios
 

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

awk sed cut? to rearrange random number of fields into 3 fields

I'm working on formatting some attendance data to meet a vendors requirements to upload to their system. With some help on the forums here, I have the data close. But they've since changed what they want. The vendor wants me to submit three fields to them. Field 1 is the studentid field,... (4 Replies)
Discussion started by: axo959
4 Replies

3. Shell Programming and Scripting

Compare fields in 2 files using AWK

Hi unix gurus, I have a urgent requirement, I need to write a AWK script to compare each fields in 2 files using AWK. Basically my output should be like this. file1 row|num1|num2|num3 1|one|two|three 2|one|two|three file2 row|num1|num2|num3 1|one|two|three 2|one|two|four ... (5 Replies)
Discussion started by: rashmisb
5 Replies

4. Shell Programming and Scripting

awk text record - prepend first field to all subsequent fields

Hello everyone, I've suddenly gotten very interested in sed and awk (and enjoying it quite a bit too) because of a large conversion project that we're working on. I'm currently stuck with a very inefficient process for processing text blocks. I'm sure someone here should be able to easily point out... (2 Replies)
Discussion started by: jameswatson3
2 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. UNIX for Dummies Questions & Answers

keeping last record among group of records with common fields (awk)

input: ref.1;rack.1;1 #group1 ref.1;rack.1;2 #group1 ref.1;rack.2;1 #group2 ref.2;rack.3;1 #group3 ref.2;rack.3;2 #group3 ref.2;rack.3;3 #group3 Among records from same group (i.e. with same 1st and 2nd field - separated by ";"), I would need to keep the last record... (5 Replies)
Discussion started by: beca123456
5 Replies

7. 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

8. Shell Programming and Scripting

How to print 1st field and last 2 fields together and the rest of the fields after it using awk?

Hi experts, I need to print the first field first then last two fields should come next and then i need to print rest of the fields. Input : a1,abc,jsd,fhf,fkk,b1,b2 a2,acb,dfg,ghj,b3,c4 a3,djf,wdjg,fkg,dff,ggk,d4,d5 Expected output: a1,b1,b2,abc,jsd,fhf,fkk... (6 Replies)
Discussion started by: 100bees
6 Replies

9. Shell Programming and Scripting

awk sort based on difference of fields and print all fields

Hi I have a file as below <field1> <field2> <field3> ... <field_num1> <field_num2> Trying to sort based on difference of <field_num1> and <field_num2> in desceding order and print all fields. I tried this and it doesn't sort on the difference field .. Appreciate your help. cat... (9 Replies)
Discussion started by: newstart
9 Replies

10. UNIX for Beginners Questions & Answers

Is there a UNIX command that can compare fields of files with differing number of fields?

Hi, Below are the sample files. x.txt is from an Excel file that is a list of users from Windows and y.txt is a list of database account. $ head -500 x.txt y.txt ==> x.txt <== TEST01 APP_USER_PROFILE USER03 APP_USER_PROFILE TEST02 APP_USER_EXP_PROFILE TEST04 APP_USER_PROFILE USER01 ... (3 Replies)
Discussion started by: newbie_01
3 Replies
CPANPLUS::Hacking(3pm)					 Perl Programmers Reference Guide				    CPANPLUS::Hacking(3pm)

NAME
CPANPLUS::Hacking - developing CPANPLUS DESCRIPTION
This document attempts to describe how to develop with the CPANPLUS environment most easily, how certain things work and why. This is basically a quick-start guide to people who want to add features or patches to CPANPLUS. OBTAINING CPANPLUS
Checkout CPANPLUS from its GIT repository at <https://github.com/jib/cpanplus-devel> . INSTALLING CPANPLUS
CPANPLUS follows the standard perl module installation process: perl Makefile.PL make make test make install CONFIGURING CPANPLUS
When running "perl Makefile.PL" you will be prompted to configure. If you have already done so, and merely wish to update the "Makefile", simply run: perl Makefile.PL JFDI=1 This will keep your configuration intact. Note however, if there are changes to the default configuration file "Config.pm-orig", you should either delete your current config file and reconfigure, or patch your config file from the new entries in "Config.pm-orig". RUNNING CPANPLUS FROM DEVELOPMENT ENVIRONMENT
If you'd rather not install the development version to your "site_perl" directory, that's no problem. You can set your "PERL5LIB" environment variable to CPANPLUS' "lib" directory, and you can run it from there. RUNNING CPANPLUS TESTS
Tests are what tells us if CPANPLUS is working. If a test is not working, try to run it explicitly like this: perl -I/path/to/cpanplus/lib t/XX_name_of_test.t 1 The extra '1' makes sure that all the messages and errors (they might be errors we're testing for!) are being printed rather than kept quiet. This is a great way to find out the context of any failures that may occur. If you believe this test failure proves a bug in CPANPLUS, the long output of the test file is something we'd like to see alongside your bug report. FINDING BUGS
Sometimes you might find bugs in CPANPLUS' behaviour. If you encounter these in a development snapshot, we'd appreciate a complete patch (as described below in the "SENDING PATCHES" section. If it's way over your head, then of course reporting the bug is always better than not reporting it at all. Before you do so though, make sure you have the latest development snapshot, and the bug still persists there. If so, report the bug to this address: bug-cpanplus@rt.cpan.org A good "patch" would have the following characteristics: Problem description Describe clearly what the bug is you found, and what it should have done instead. Program demonstrating the bug Show us how to reproduce the bug, in a simple of a program as possible [OPTIONAL] A patch to the test suite to test for the bug Amend our test suite by making sure this bug will be found in this, and future versions of CPANPLUS (see "SUPPLYING PATCHES") [OPTIONAL] A patch to the code + tests + documentation Fix the bug, update the docs & tests. That way your bug will be gone forever :) SUPPLYING PATCHES
Patches are a good thing, and they are welcome. Especially if they fix bugs you've found along the way, or that others have reported. We prefer patches in the following format: o In "diff -u" or "diff -c" format o From the root of the snapshot o Including patches for code + tests + docs o Sent per mail to bug-cpanplus@rt.cpan.org o With subject containing "[PATCH]" + description of the patch You will always be informed if a patch is applied or rejected, and in case of rejection why that is (perhaps you can tweak the patch to have it accepted after all). perl v5.18.2 2014-01-06 CPANPLUS::Hacking(3pm)
All times are GMT -4. The time now is 08:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy