inconsistent cat output


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users inconsistent cat output
# 1  
Old 01-23-2011
inconsistent cat output

Hi
I'm executing a menu script in which I `cat a file` but it's giving different output some times. Following is the code fragment taken from my script.
Code:
while true
do
cat procs.configured
echo ---------separator--------------
sleep 3
done

when I execute this code fragment, `cat` outputs the file procs.configured in a jumbled way. is there any buffering kind of things needs to be taken care.

Appreciated your help.

Last edited by Yogesh Sawant; 02-01-2011 at 04:23 AM.. Reason: added code tags
axes
# 2  
Old 01-23-2011
Hard to guess without knowing whether this is a normal unix text file or whether the file is open for write by another process.
In case the data contains screen control codes, you could try:
Code:
cat -v procs.configured

# 3  
Old 01-24-2011
Thanks methyl for your reply.
I tried with cat -v but no luck

procs.configured is a unix file only and it's not opened by another process.

Actually I sent the code fragment of my main menu script. procs.configured file is populated by the same menu script and will contain all the procs running status info with colors(tput and some control characters are used).

we have three environments(dev/int/uat). Right now this problem is coming in one environment. earlier it used to come in other environment.

Are there any other environment variables to check or is there any substitute command to 'cat procs.configured'.

Thanks in advance.

---------- Post updated at 01:19 AM ---------- Previous update was at 12:54 AM ----------

Hi methyl

Problem is solved.

In one of my environment, as you guessed one more menu script process running in background and populating the procs.configured file.
axes
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Getting output from a file similar to cat output

I have a file # cat /root/llll 11 22 33 44 When I cat this file content to a variable inside a shell script and echo that shell script, it does not show up as separate lines. I need echo output similar to cat. cat /root/shell_script.sh #!/bin/bash var=`cat /root/llll` echo $var (2 Replies)
Discussion started by: anil510
2 Replies

2. Shell Programming and Scripting

Cat writing only one record in the output file

Hi All, I have an input file containing data as below: Input.DAT XXXXXXX|YYYYYYY|ZZZZZZZZZZ|12334446456|B|YY|111111111|111111111|111111111|111111111|15|3|NNNNNN|Y|3|AAA|111111111... (11 Replies)
Discussion started by: sagar.cumar
11 Replies

3. Shell Programming and Scripting

inconsistent output using date()

I have an input list of: I am just trying to turn this list into its seconds since epoch "+%s" time equivalent. I'm trying to use the following, but every time I run the command it gives me different answers, they are close, but never the same... any clues as to why? xargs -I{} date -j -f... (3 Replies)
Discussion started by: mdlloyd7
3 Replies

4. Shell Programming and Scripting

Cat piped output

Hello, How can I efficiently cat piped output with another file? > (awk command) | cat file1 (piped output) Thanks! (11 Replies)
Discussion started by: palex
11 Replies

5. Shell Programming and Scripting

combining cat output and cutting rows

I have a file that contain the following. -D HTTPD_ROOT="/usr/local/apache" -D SERVER_CONFIG_FILE="conf/httpd.conf" I want a shell script, so that after cat filename and apply the shell script I should get the output as follows. /usr/local/apache/conf/httpd.conf ie cat filename |... (7 Replies)
Discussion started by: anilcliff
7 Replies

6. Shell Programming and Scripting

Error output of cat to /dev/null

Hello, I'm trying to send the error output of a 'cat' operation to /dev/null like this: cat /dirA/dirB/temp*.log > /dirA/dirB/final.log 2>/dev/null This works perfectly in a terminal, but not when placed in a script. If there are no files matching temp*.log the script outputs an error... (7 Replies)
Discussion started by: Nils88
7 Replies

7. Shell Programming and Scripting

cat and output filename

Hi, how I can display a file with cat and printing the filename before each line. e.g. file1 { one two three four five } Output: file1:one file2:two file1:three file1:four file1:five (12 Replies)
Discussion started by: Timmää
12 Replies

8. Shell Programming and Scripting

cat file and parse output

Hello, I'm new to shell scripting and did a search on the forum to what I want to do but couldn't find anything. I have about 9 routers that outputs to 1 syslog file daily named cisco.year.mo.date.log ex: cisco.2009.05.11.log My goal is to make a parsing script that cats today's syslog... (2 Replies)
Discussion started by: jjrambar
2 Replies

9. UNIX for Dummies Questions & Answers

unix cat gives no output

hi, i searched the forum, but found no thread relate to this; so sorry if it's duplicated. I'm using unix cat command but it gives no output. I check permission, owner and group; all of which are OK. I could do less and vi. any suggestions? thanks, (2 Replies)
Discussion started by: notvwatcher
2 Replies

10. UNIX for Dummies Questions & Answers

How to Display a range of values in the output of cat

When I use this command I get an output of some numbers cat ac.20070511 | cut -d" " -f19 Is there any way for me to display only the numbers that are greater than 1000 but not all the numbers in the ouput. Can any one help me with this. :) (8 Replies)
Discussion started by: venu_nbk
8 Replies
Login or Register to Ask a Question