Yes, sorry...yes I know it's an awk script based on the extension of the script.
==============
The process that invokes the awk script:
1. Check for source file arrival
2. Header date verified on incoming file from internal sql query to database
lookup table
3. Translate unwanted Characters to spaces
4. Move file from source directory to processing directory
After the above completes, the Verify Record Length AWK script automatically begins.
1. Veryifies total records and checks record lengths
===============
What Linux system are you using? Red Hat Enterprise Linux Server release 5.8 (Tikanga)
What shell are you using on Linux? Korn
What version of AIX are you using on your AIX server? 5.3.0.0
What shell is being used on your AIX server? Korn
Is the input data file encoded in EBCDIC? Do not know.
I repeat (from my 1st posting in this thread:
Quote:
Please show us the exact command line that is being used to invoke awk using this script file and show us how the input file is being passed to awk.
I understand the English description of the processing that is going on. To help you with your problem, we need to see the exact Korn shell commands that are being used to run your awk script. Saying:
Quote:
After the above completes, the Verify Record Length AWK script automatically begins.
doesn't give us any way to evaluate what might be going wrong.
Length of first line:
If nothing else is to be processed, immediate exit is faster ---------- Post updated at 04:23 PM ---------- Previous update was at 04:15 PM ----------
Don suspects you run your script by the wrong interpreter. I can hardly believe this since you provided logfile. But to be sure I agree you should show how you run it.
Hi SoloXX,
When I last posted on this thread, I hadn't seen the sample input that you posted in message #3 in this thread 1 or 2 minutes before I hit the Submit Reply button. Now that we know that you have no idea what is going on, let me make a few commnets based on what you have shown us. First using CODE tags instead of ICODE tags and reformatting your awk script, it looks like this:
You keep asking how to find out how many characters are in the first line of your input file, but (as shown by the lines marked in red) this awk script doesn't care what the length is for the first line. It is checking to see that the length of every line AFTER the first line contains 710 characters not counting the terminating <newline> character. It assumes that the first line in the file contains at least 43 characters, but does not verify that that is true.
If you don't know how this awk script is being run, how do you know it isn't working correctly???
The file you uploaded (First row of src file.txt) happens to have 712 characters in the 1st line (counting the trailing <carriage-return> and <newline> characters), but the second line is incomplete. Since the file you uploaded contained 1422 bytes (and only contained one <newline> character as the 712th character in the file), we have no idea how long the 2nd line in the file is. Since awk is only specified to work on text files, the behavior of this script is unspecified when given your uploaded file as input. On OS X, it yields:
but if you add a <carriage-return> and a <newline> to the end of your uploaded file (matching what is at the end of the 1st line in the file), it yields:
As I said all of this is based on lots of conjecture, but if you won't show us how the script is used, how the input file is massaged before feeding it to the script, and any other pertinent details that have been hidden by not showing us how this awk script is invoked; we can't make any concrete suggestions on what, if anything, might be wrong. Maybe the <carriage-return> characters in you input file are discarded before the input is fed into this awk script??? Maybe the only <carriage-return> in the input file is in the first line (where it will be ignored).???
Hi Team,
I have an issue to split the file which is having special chracter(German Char) using awk command.
I have a different length records in a file. I am separating the files based on the length using awk command.
The command is working fine if the record is not having any... (7 Replies)
Hi,
The record length may be differ in afile. I want to display the records if the record length is not equal to 50 using sed/awk command.
Thanks in Advance (6 Replies)
I have records with different lengths say 386, 387 and 388. Do i have any command to view all the records of the length 386 ? Please do advise.
Thanks (2 Replies)
Very, very new to unix scripting and have a unique situation. I have a file of records that contain 3 records types:
(H)eader Records
(D)etail Records
(T)railer Records
The Detail records are 82 bytes in length which is perfect. The Header and Trailer records sometimes are 82 bytes in... (3 Replies)
Hi,
I have a problem, please help me,
I have a flat file like this:
P00000000088888888999999999 0000999903 000000000000000000
P00000000077777777000000000 0000999903 000000000000000000
P00000000044444444333333333 0000999903 00000000000000000079875
P00000000066666666111111111 0000999903 ... (5 Replies)
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)
Hi there, using the command below
> cat file1 | tr "\001" " " > tmp2
how can I alter the record length of tmp2 to fix length of 350 bytes ?
Thanks a lot! (7 Replies)
hello!
I have a file with fixed record length...
format:
123445asdfg 4343777 sfgg
I wanna convert it to
123445,asdfg ,4343,777 ,sfgg
is there any way to do it?
sed/grep/awk??
at the moment I use sed -e 's_ \(\)_,\1_g'
but it works only if there are spaces between... (16 Replies)