Sponsored Content
Full Discussion: how to fix this awk script?
Top Forums Shell Programming and Scripting how to fix this awk script? Post 302286537 by joeyg on Wednesday 11th of February 2009 11:37:33 AM
Old 02-11-2009
Tools

I think it is because you are always printing a value. So, you are not over-writing 'a' ni the instance of the 4th line, so when you print the variable, you are getting the last stored value of 'a'.
Perhaps as the first line ater your else, do a
Code:
a=""

to blank out the last 'a' value?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk / shell - Fix broken lines and data

Gurus, I am struggling with a issue and thought I could use some of your expertise. Need Help with this I have a flat file that has millions of records 24|john|account ~ info |56| 25|kuo|account ~ journal |58| 27|kim|account ~ journal |59| 28|San|account ~ journal |60|... (3 Replies)
Discussion started by: rimss
3 Replies

2. Shell Programming and Scripting

fix a problem in this script

z=9 i=0 h=02 min=55 while do cat /home/barmecha/test | grep $h:$min >> /home/barmecha/file1 min=`expr $min + 1` if ; then h=`expr $h + 1` fi i=`expr $i + 1` done i have a log file with time wise log in it, this script help me to pull out logs of the give time interval...but the... (8 Replies)
Discussion started by: abhishek27
8 Replies

3. Shell Programming and Scripting

AWK record length fix

Hi Friends, Need some help in AWK. Working on AIX 5 Have been trying the following functionality to make the record length fixed: if( length(record) < 300 ) { printf("%-300s\n", record); } In my opinion it will apply some fillers in the end. Its is not making any... (4 Replies)
Discussion started by: kanu_pathak
4 Replies

4. Shell Programming and Scripting

how to fix the column length in a file using Awk Prog

Hi I use the following code to read the file and to fix the length of the column of the record in the file 'Sample.txt' ls Samp* | awk ' { a=$1 } END{ FS="n" for(i=1;i<=NR;i++) { while( getline < a ) { f1=$0; print("Line::",f1); f2=substr(f1,1,10) print("Field1::",f2);... (10 Replies)
Discussion started by: meva
10 Replies

5. Shell Programming and Scripting

How to fix this awk

I have a script which will mask the 9th and 15th column in a record starting with BPR. The record looks like below before my script BPR*C*160860.04*C*ACH*CTX*01*072000326*DA*1548843*3006968523**01*071000013*DA*5529085*100323*VEN The record will be masked after my script parses this... (19 Replies)
Discussion started by: Muthuraj K
19 Replies

6. Shell Programming and Scripting

Fix timestamp with Sed or Awk

Hi I am dealing with the following string: Date: Thur, 13 March 2011 01:01:10 +0000 I asked for help in another topic that converted a similar string: Date: Thur, 13 March 2011 9:50 AM To a 24 hr standard. The problem is that it comes out as: Date: Thur, 13 March 2011 9:50:00 +0000... (4 Replies)
Discussion started by: duonut
4 Replies

7. UNIX for Dummies Questions & Answers

Please help to fix awk script

Good morning, fellows. I would need to ask for your help in editing my awk script. Here is the original version: BEGIN { printf ("CRYST1 200.000 200.000 200.000 90.00 90.00 90.00 P 1 1\n") maxatoms=1000 natom=0 found_struct = 0 found_bond = 0 } { if( NF == 5 ) { foundff=0 natom++... (9 Replies)
Discussion started by: snysmumrik
9 Replies

8. Shell Programming and Scripting

My script failed and can't fix it ?

Hi , I'd like to give you a little bit idea about my script which is used to get any generated file from remote server using ftp session then organized those file into directories based on their date ( at the end I supposed to have 1 months directories 20130401 20130402 ....20130430 ,... (27 Replies)
Discussion started by: arm
27 Replies

9. Shell Programming and Scripting

awk if condition match and fix print decimal place

Hi All, I have problem in the middle of implementing to users, whereby the complaint is all about the decimal place which is too long. I need two decimal places only, but the outcome from command is always fixed to 6. See the sample : before: Sort Total Site Sort SortName Parts ... (3 Replies)
Discussion started by: horsepower
3 Replies

10. UNIX for Dummies Questions & Answers

awk file subtracted by a fix value - conditioned

Hi all... i have been trying to make this work but I have been failing for 6 hours .. I know it should be something simple that I am missing to it would be great if you can help me ... I want to subtract a fixed value (lets set 1) from any value >=1 from the whole file my file looks like ... (4 Replies)
Discussion started by: A-V
4 Replies
SRCONV(1)						  The Canonical Csound Reference						 SRCONV(1)

NAME
srconv - Converts the sample rate of an audio file. . DESCRIPTION
Converts the sample rate of an audio file at sample rate Rin to a sample rate of Rout. Optionally the ratio (Rin / Rout) may be linearly time-varying according to a set of (time, ratio) pairs in an auxiliary file. SYNTAX
srconv [flags] infile INITIALIZATION
Flags: o -P num = pitch transposition ratio (srate / r) [don't specify both P and r] o -P num = pitch transposition ratio (srate / r) [don't specify both P and r] o -Q num =quality factor (1, 2, 3, or 4: default = 2) o -i filnam = auxiliary breakpoints file (no breakpoint by default. i.e. No ratio change) o -r num = output sample rate (must be specified) o -o fnam = sound output filename o -A = create an AIFF format output soundfile o -J = create an IRCAM format output soundfile o -W = create a WAV format output soundfile o -h = no header on output soundfile o -c = 8-bit signed_char sound samples o -a = alaw sound samples o -8 = 8-bit unsigned_char sound samples o -u = ulaw sound samples o -s = short_int sound samples o -l = long_int sound samples o -f = float sound samples o -r N = orchestra srate override o -K = Do not generate PEAK chunks o -R = continually rewrite header while writing soundfile (WAV/AIFF) o -H# = print a heartbeat style 1, 2 or 3 at each soundfile write o -N = notify (ring the bell) when score or miditrack is done o -- fnam = log output to file This program performs arbitrary sample-rate conversion with high fidelity. The method is to step through the input at the desired sampling increment, and to compute the output points as appropriately weighted averages of the surrounding input points. There are two cases to consider: 1. sample rates are in a small-integer ratio - weights are obtained from table. 2. sample rates are in a large-integer ratio - weights are linearly interpolated from table. Calculate increment: if decimating, then window is impulse response of low-pass filter with cutoff frequency at half of output sample rate; if interpolating, then window is impulse response of lowpass filter with cutoff frequency at half of input sample rate. CREDITS
Author: Mark Dolson August 26, 1989 Author: John ffitch December 30, 2000 AUTHORS
Barry Vercoe MIT Media Lab Author. Dan Ellis MIT Media Lab, Cambridge Massachussetts Author. COPYRIGHT
5.10 08/01/2011 SRCONV(1)
All times are GMT -4. The time now is 11:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy