## Reduce the count on the 98 record by 2,

Reduce the count on the 98 record by 2,
# 1
06-30-2011
Reduce the count on the 98 record by 2,

recod,amount,noofaccount,count
98,+00000187865779787,00319,000000640/
99,+00000187865779787,00001,000000642/

thsi is my input file my question is
1) Reduce the count on the 98 record by 2
 sgoud View Public Profile for sgoud Find all posts by sgoud
# 2
06-30-2011
This User Gave Thanks to itkamaraj For This Post:
 itkamaraj View Public Profile for itkamaraj Find all posts by itkamaraj
# 3
06-30-2011

Last edited by yazu; 06-30-2011 at 11:14 AM.. Reason: Better
This User Gave Thanks to yazu For This Post:
 yazu View Public Profile for yazu Find all posts by yazu
# 4
06-30-2011

---------- Post updated at 04:43 AM ---------- Previous update was at 04:25 AM ----------

can u please explain how the script is working deatail
 sgoud View Public Profile for sgoud Find all posts by sgoud
# 5
06-30-2011
-F","- Field seperator is ,(comma)
/^98/ - Check if the line starts with 98
for(i=1;i<=NF;i++) - iterate all the fields (comma seperated)
if(i==1){printf ("%s",\$i-2);} - if it first field, then subtract the value by 2 (we only taking the rows starts with 98, so it will print 96)
else if (i==NF) {printf(",%s\n",\$i);} - if it is last field, then print the field and print new line character
else {printf(",%s",\$i)}}}' - for other fields, print ,(comma) and the fileds
 itkamaraj View Public Profile for itkamaraj Find all posts by itkamaraj
# 6
07-01-2011
how it working please give explain the script
awk 'BEGIN {FS=OFS=","} \$1==98 {\$4=sprintf("%0.9d/", \$4-2)}1' testfile i am new to shell scripting
 sgoud View Public Profile for sgoud Find all posts by sgoud
# 7
07-01-2011
There are three parts:
1) BEGIN {FS=OFS=","} # make (input) Field Separator and Output Field Separator = ","

then for every line:
2) \$1==98 {\$4=sprintf("%0.9d/", \$4-2)} # if the first field is equal 98, change the fourth field
3) 1 # print every line of input - it's shortcut for 1 {print \$0}, where 1 is counted as true value.

\$4=sprintf("%0.9d/", \$4-2) # apply the string format function with the format "%0.9d/" to the result \$4-2 (in awk every variable/field can be treated as a number or a string. If there are some non-digit chars after digit chars they are discarded).
 yazu View Public Profile for yazu Find all posts by yazu

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

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

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

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

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

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

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

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

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

## 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: