AWK getline quits inexplicably after many lines


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting AWK getline quits inexplicably after many lines
# 1  
Old 08-28-2009
AWK getline quits inexplicably after many lines

I am using getline to read a file in a BEGIN block:

Code:
BEGIN {  
	while ((getline < "testFile.html") > 0) { 
		print $0 > "text.html" 
	}
}

The file is a normal HTML file. For some reason that I have not been able to discover in the text of the file, getline never finishes and the file is not entirely written into "test.html". I wonder if anyone could shed any light on what might be happening, because I have not been able to track it down.

Thanks very much,

Enobarbus
# 2  
Old 08-28-2009
Are any lines in the input file greater in length than
Code:
getconf LINE_MAX

That will cause termination
# 3  
Old 08-28-2009
Thank you Jim for this tip.

I had made a stupid, stupid, stupid rookie mistake. The program was inadvertently set-up to take text from the command line and there was none forthcoming so it hung.

My deepest apologies for this post.

Enobarbus:Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk with if, getline, and another if

Howdy Folks, It seems like it is always awk that confuses the heck out of me and I even have books and examples. I have this line: awk '{if (/clientIP/)(SRV = $NF); if ($2 ~ /BUNDLE-GIM/) getline; if ($2 ~ /r100595/) {print SRV,"BUNDLE-GIM",$2}}' post.txt to parse this text: <api... (4 Replies)
Discussion started by: port43
4 Replies

2. Shell Programming and Scripting

awk getline

Hi, I have an awk script with the following function in it . function cmd( c ) { while( ( c | getline foo) > 0 ){ return foo ; close( c ); } } c =... (4 Replies)
Discussion started by: MetaMan
4 Replies

3. Shell Programming and Scripting

awk getline problem

Hello, I want to print out the DNA sequence entries (tens of thousand!) that are longer than certain value (i=200) from a file (FASTA file) as: >S94D_ctg_8004 Average coverage: 402.95 ATAATGCCTGTGAATATGACATGTGTTCCTGTTTCTACATCAGACTACTATTCTTGCATA... (12 Replies)
Discussion started by: yifangt
12 Replies

4. Shell Programming and Scripting

AWK getline command to read more then two lines

Hello, Am trying to print three lines in a single line using AWK getline command. Below is the command am trying and its displaying only two lines in a single line. Command: awk '{getline n; printf($0,t);next}' Can you please help me ? Thanks, Prince (1 Reply)
Discussion started by: prince1987
1 Replies

5. Shell Programming and Scripting

Some Awk Getline help?

Greetings, I have about 3000 files that I want to search. The first column in all of these 3000 files has a unique serial number on each line. The subsequent columns have lots of data. I have another masterfile with three columns to help me find all the data I need in a moments notice: col 1... (15 Replies)
Discussion started by: jeeplou
15 Replies

6. Shell Programming and Scripting

awk getline question

Hi there, I have an ifconfig output and i want to write a script that determines whether there is a line "groupname ipmp" on a particular interface here is my example ifconfig -a output lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1 inet 127.0.0.1... (2 Replies)
Discussion started by: rethink
2 Replies

7. Shell Programming and Scripting

Using getline in awk

I am using awk and want to use getline from a file like below getline x < file However file consists of two columns and I only want to store $2 Any way I can do this? ---------- Post updated at 06:54 AM ---------- Previous update was at 06:45 AM ---------- Done something like this.... (1 Reply)
Discussion started by: kristinu
1 Replies

8. Shell Programming and Scripting

syntax about getline of awk

i want to use getline to read command output to a var but the command i want to run is composed of a string and a variable,example: echo "" | awk 'BEGIN{myfile="anyfilename"}{"ls -l "myfile | getline a;print a}'and i got a error sh: anyfilename: command not foundit seems awk just ignored the... (4 Replies)
Discussion started by: b33713
4 Replies

9. Shell Programming and Scripting

awk getline

How do you make the getline function return to the original line? The example below should make it clear where I am currently going wrong. Thanks AWK SCRIPT: ------------- awk -F '-' '{ tmpLine = "EMPTY" print "CURRENT LINE :"$0 getline tmpLine print "NEXT LINE :"tmpLine }'... (1 Reply)
Discussion started by: garethsays
1 Replies

10. Shell Programming and Scripting

awk getline help maybe?

hello collegues, I am attempting to use awk to search file1 (serverlist.csv) from each row with file2 (supported.txt). If the is no entry exists in serverlist then output to a file called notsupp.out if there is an entry output to supp.out I can do this with basic shell scripting however... (0 Replies)
Discussion started by: chlawren
0 Replies
Login or Register to Ask a Question