UNIX Default Record Length in AWK


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users UNIX Default Record Length in AWK
# 1  
Old 08-26-2001
Question UNIX Default Record Length in AWK

Hello -

QUESTION:
Is there a way to override the default record length limitation over awk in Unix?
Or, is there a better way to do what I am trying to do than the way I am trying to do it now? (See BACKGROUND and CURRENT PROCEDURE below...)

BACKGROUND:
In a Kornshell script, I have to search a file using variable criteria and produce a range of records from within the original input file. I am piping the file from Unix Kornshell commands to an awk procedure. I basically want to extract a range of records out of the original file, based on input criteria.

PROBLEM:
Awk is relaying to me that the record is too long to process.

CURRENT PROCEDURE:
To overcome the length problem, I am "cut"-ting the records as I pipe them to the awk procedure, and that is working OK - - I do get the expected output from the procedure.
But then I have to use a Unix "grep" with the output of the awk procedure against the original file to put the selected records from the file 'back together' with the original. Consequently, the "grep" is taking too long (it is an interactive script).
Is there a better way to do this?
- -
FYI:
The original records are a bit over 7000 bytes in length.
The "cut" records passed to and output from awk are 50 bytes.
- -
Thanks,
Jim

# 2  
Old 01-25-2002
better late than never

I know this is rather late considering your post date.

You should be able to use the ulimit command. Do something like this:

ulimit 99999

This should open up your limitations to allow your script to run.

If that doesn't work, try using the xargs option with the grep command

Do a man on xargs. It is very useful.

Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert variable length record to fixed length

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)
Discussion started by: Anthuvan
7 Replies

2. Shell Programming and Scripting

Verifying Record Length

Hi all, We are going through a total migration from AIX-based server framework to Linux-based servers. When I am testing *.sh and *.awk in a lower environments, it abends at the same step everytime in verifying the record length of the first row of the source file. I know this source file... (11 Replies)
Discussion started by: SoloXX
11 Replies

3. Shell Programming and Scripting

Record length

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)
Discussion started by: NareshN
6 Replies

4. Shell Programming and Scripting

Make variable length record a fixed length

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)
Discussion started by: jclanc8
3 Replies

5. Shell Programming and Scripting

awk to find the length of each record.

Hi Guys, I wanted to print the length of each record and the record itself. I tried the following awk ... awk 'a=length(); {print $a,$0}' file1 But it is giving me the records instead of length. and also, it giving me each record twice. Means the value of a is not the length of the... (0 Replies)
Discussion started by: mac4rfree
0 Replies

6. Shell Programming and Scripting

Check length of record

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)
Discussion started by: DebianJ
5 Replies

7. UNIX for Dummies Questions & Answers

What the command to find out the record length of a fixed length file?

I want to find out the record length of a fixed length file? I forgot the command. Any body know? (9 Replies)
Discussion started by: tranq01
9 Replies

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

9. Shell Programming and Scripting

Record Length too long -- AWK Problem

Hi All, I have a txt file which is an export of a query result from the database. The txt file contains 'Processid#sqlquery' from the database table.As the sqlquery is too long.... i am unable to get the fields seperated using the awk script as below:- cat sql.txt | awk -F'#' '{printf $2}'... (2 Replies)
Discussion started by: venkatajay_18
2 Replies

10. Shell Programming and Scripting

fixed record length

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)
Discussion started by: george_
16 Replies
Login or Register to Ask a Question