Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Reduce the count on the 98 record by 2, Post 302535204 by itkamaraj on Thursday 30th of June 2011 05:05:09 AM
Old 06-30-2011
Code:
 
$nawk -F"," ' /^98/ {for(i=1;i<=NF;i++){if(i==1){printf ("%s",$i-2);} else if (i==NF) {printf(",%s\n",$i);} else {printf(",%s",$i)}}}' input
96,+00000187865779787,00319,000000640/
 
$cat test
98,+00000187865779787,00319,000000640/
99,+00000187865779787,00001,000000642/

This User Gave Thanks to itkamaraj For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to count the record count in an EBCDIC file.

How do I get the record count in an EBCDIC file on a Linux Box. :confused: (1 Reply)
Discussion started by: oracle8
1 Replies

2. Shell Programming and Scripting

Need help with Isql record count

What I am trying to do is check if the database query returned any records. If no records returned then output a message else output results to a file. Right now if I take out the if and else statements the code runs fine and sends the email. If no records returned the email sends the column... (4 Replies)
Discussion started by: johnu122
4 Replies

3. Shell Programming and Scripting

record count

i have a file named file_names.dat where there are several files along with their path. exp: /data1/dir1/CTA_ACD_20071208.dat /data1/dir1/CTA_DFG_20071208.dat i want to write a script which will create a csv file with the name of the file and record count of that file the output file... (4 Replies)
Discussion started by: dr46014
4 Replies

4. Shell Programming and Scripting

replaying a record count with another record count

i use unix command to take the record count for a file1 awk 'END{print NR}' filename i already have a file2 which conatin the count like ... .. rec_cnt=100 .. .. I want to replace the record in the file2 using the record i take from file1. suggest me some simple ways of doing it... (2 Replies)
Discussion started by: er_zeeshan05
2 Replies

5. UNIX for Advanced & Expert Users

character count per record

Hello can someone please advise. I need to send records in a file that are over 10,000 characters long to a seperate file. Any ideas? Thanks (2 Replies)
Discussion started by: Dolph
2 Replies

6. Shell Programming and Scripting

Validate record count

Hi all How to verify the number of records in case of delimited file, If the file has records. And then if it is not equal to mentioned no. of records, email is triggered and file is moved to bad directory path. Example ----- input file = a.txt bad directory path : /usr/bin/bad (6 Replies)
Discussion started by: balaji23_d
6 Replies

7. Shell Programming and Scripting

Character count per record

I have a flat file. How can i retrive the character count per record in whole file. Can anybody assist me on this Cheers (9 Replies)
Discussion started by: subrat
9 Replies

8. Shell Programming and Scripting

Validating the record count

Hi , I am having a text file with several records., it has a header record and trailer record. The header record has the number of rows (records) found in the text file and time-stamp. The footer record has the total number of records ( along with the header and trailer., Suppose: wc -l... (4 Replies)
Discussion started by: cratercrabs
4 Replies

9. Shell Programming and Scripting

count of record in files

Hi all, I have written a scripts which count number of lines in all the files in a directory and write in a text file. I don't know how to format it while writing. OS suns solaris 10 my scripts is as below for i in /ersdg3/ERS/ERS_INPUT_LOGS/RIO/LOGS/RIO_02-Aug-2012/ *.LOG do echo... (11 Replies)
Discussion started by: guddu_12
11 Replies

10. UNIX for Dummies Questions & Answers

Reduce system inode count

I have lots of space on my system. linux-e30c:~ # df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 41G 3.4G 35G 9% / /dev/sda3 91G 36G 51G 42% /home /dev/sda2 99G 3.4G 91G 4% /usr But still somehow the inode count has almost finished... (3 Replies)
Discussion started by: rupeshkp728
3 Replies
Reduce(3)						User Contributed Perl Documentation						 Reduce(3)

NAME
PDL::Reduce -- a "reduce" function for PDL DESCRIPTION
Many languages have a "reduce" function used to reduce the rank of an N-D array by one. It works by applying a selected operation along a specified dimension. This module implements such a function for PDL by providing a simplified interface to the existing projection func- tions (e.g. "sumover", "maximum", "average", etc). SYNOPSIS
use PDL::Reduce; $a = sequence 5,5; # reduce by adding all # elements along 2nd dimension $b = $a->reduce('add',1); @ops = $a->canreduce; # return a list of all allowed operations FUNCTIONS
reduce reduce dimension of piddle by one by applying an operation along the specified dimension $a = sequence 5,5; # reduce by adding all # elements along 2nd dimension $b = $a->reduce('add',1); $b = $a->reduce('plus',1); $b = $a->reduce('+',1); # three ways to do the same thing [ As an aside: if you are familiar with threading you will see that this is actually the same as $b = $a->mv(1,0)->sumover ] NOTE: You should quote the name of the operation (1st arg) that you want "reduce" to perform. This is important since some of the names are identical to the names of the actual PDL functions which might be imported into your namespace. And you definitely want a string as argu- ment, not a function invocation! For example, this will probably fail: $b = $a->reduce(avg,1); # gives an error from invocation of 'avg' Rather use $b = $a->reduce('avg',1); "reduce" provides a simple and unified interface to the projection functions and makes people coming from other data/array languages hope- fully feel more at home. $result = $pdl->reduce($operation [,$dim]); "reduce" applies the named operation along the specified dimension reducing the input piddle dimension by one. If the dimension is omitted the operation is applied along the first dimension. To get a list of valid operations see canreduce. canreduce return list of valid named "reduce" operations Some common operations can be accessed using a number of names, e.g. '+', "add" and "plus" all sum the elements along the chosen dimension. @ops = PDL->canreduce; This list is useful if you want to make sure which operations can be used with "reduce". AUTHOR
Copyright (C) 2000 Christian Soeller (c.soeller@auckland.ac.nz). 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 sepa- rated from the PDL distribution, the copyright notice should be included in the file. perl v5.8.0 2001-07-07 Reduce(3)
All times are GMT -4. The time now is 11:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy