Empty buffer when is full


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Empty buffer when is full
# 1  
Old 04-13-2010
Question Empty buffer when is full

Hello everyone!

This is the situation:

I execute this command from a bash script:

Code:
telnet 10.99.246.14 6001 >> output.txt

The question is:
How I do to execute this command and empty the buffer when is full?
The script is always running.

Thanks a lot!
# 2  
Old 04-13-2010
What do you mean by buffer?

If by buffer you mean file, you could:

Code:
( telnet 10.99.246.14 6001 | split -a 4 -d -l 5000 - output. )

This will produce output.0000, output.0001, etc. split apart every 5000 lines. You can delete the old files and it will continue making new ones.

---------- Post updated at 02:24 PM ---------- Previous update was at 02:15 PM ----------

Actually, it can be far simpler. 'echo > output.txt' will clear it out.
# 3  
Old 04-16-2010
Quote:
Originally Posted by Corona688
What do you mean by buffer?

If by buffer you mean file, you could:

Code:
( telnet 10.99.246.14 6001 | split -a 4 -d -l 5000 - output. )

This will produce output.0000, output.0001, etc. split apart every 5000 lines. You can delete the old files and it will continue making new ones.

---------- Post updated at 02:24 PM ---------- Previous update was at 02:15 PM ----------

Actually, it can be far simpler. 'echo > output.txt' will clear it out.
I was referring to the console buffer...but with your help my problem is resolved.
Many thanks!
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. AIX

100% Inode full with only 67% FS full.

AIX Version 6.1 and 7.1. I understand that when the OS initially creates the FS and inodes, its pretty strict, but not always tuned to a 1:1 ratio. I see the same thing when adding a whole disk LV to a separate device. It seems that when we expand a filesystem the inodes don't get tuned... (5 Replies)
Discussion started by: mrmurdock
5 Replies

2. Programming

buffer in C

Hello, size_t write(int fd, const void *buf, size_t count) { static size_t (*write_func)(int, const void *, size_t) = NULL; if (!write_func) write_func = (size_t(*)(int, const void *, size_t)) dlsym(RTLD_NEXT, "write"); char tmp; memcpy(tmp,buf,count); ... (3 Replies)
Discussion started by: chercheur857
3 Replies

3. Shell Programming and Scripting

Check if Queue empty or full in perl

Hi, I got problem with queue code how to determined empty and full and problem with while loop Here is my pseudo code : Input page Access Input Pgae Frame For i =3 to pageframe count by 1 construct queue of size i set pageFaultCount to 0 while morepages do page = NextPage... (1 Reply)
Discussion started by: guidely
1 Replies

4. Shell Programming and Scripting

EXPECT help with full buffer(?), or other available solutions

First, to level set: I'm proficient enough with basic BASH scripting for simple things (say, 4 out of 10), but this current project really requires a higher understanding of EXPECT than I have. I have an interactive-only control application residing locally on a database server that I would... (2 Replies)
Discussion started by: toeharp
2 Replies

5. Shell Programming and Scripting

How to extract strings from full path when full path is not fixed

/Path/snowbird9/nrfCompMgrRave1230100920.log.gz:09/20/2010 06:14:51 ERROR Error Message. /Path/snowbird6/nrfCompMgrRave1220100920.log.gz:09/20/2010 06:14:51 ERROR Error Message. /Path/snowbird14/nrfCompMgrRave920100920.log.gz:09/20/2010 06:14:51 ERROR Error Message.... (0 Replies)
Discussion started by: Shirisha
0 Replies

6. Shell Programming and Scripting

expect_out(buffer) empty

I have only some info into my buffer, but after a rssi command I see the folowing lines expected into buffer but not present : rssi=-106 rssi=-109 I see in my buffer only the first part of the output, here you are a part of script : #!/usr/bin/expect -f #global expect_out match_max 10000000... (1 Reply)
Discussion started by: ugobale
1 Replies

7. UNIX for Dummies Questions & Answers

Getting same exit status for empty and non empty file

Hi All, I am checking for a empty input file to do some further action , but I am getting exit status 0 in both the cases , for empty and non empty file both. The value of $? is coming 0 in if part also and else part too. #!/bin/ksh if ]; then echo "data" # exit 0 echo "$?" else... (4 Replies)
Discussion started by: mavesum
4 Replies

8. UNIX for Dummies Questions & Answers

how to find empty folders without using -empty

hi all: my solaris FIND does not support find myFolder -type d -empty how can i find the empty folders? thanks! (7 Replies)
Discussion started by: lasse
7 Replies

9. UNIX for Dummies Questions & Answers

Why is my buffer empty in vi?

this question is probably trivial to most of you but i do not have the answer. the task is simple... yank 7 lines of text from one file and paste them to another so while in command mode i enter "b7yy and i get 7 lines yanked exit vi with :q! open the new file while in command mode i... (2 Replies)
Discussion started by: cookiebooy
2 Replies
Login or Register to Ask a Question