Why are my text files sometimes empty when I make a read to them?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Why are my text files sometimes empty when I make a read to them?
# 1  
Old 08-14-2011
Why are my text files sometimes empty when I make a read to them?

My implementation:

I have a script Caller.sh that runs in the background that continuously calls the following scripts:

createtext.sh
createtext2.sh
createtext3.sh

Each of these scripts does the following (but with different text file names):

Code:
#! /bin/bash

LogFiletmp="getinfotmp.txt"
LogFile="getinfo.txt"

ssh admin@localhost "show all" > $LogFiletmp         #this output is redirect to a temp file
mv $LogFiletmp $LogFile

I have other scripts that read getinfo.txt, but at times, the text file is empty for up to a couple seconds...Does anybody know why? getinfo.txt should always have something in it and the mv command should work pretty fast right?
# 2  
Old 08-15-2011
Code:
ssh admin@localhost "show all" >> $LogFiletmp

>> means append the output

> means empty the file, then export the output.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Read .xlsx and text files in a loop using openpyxl

I have a list of .xlsx files (names 1.xlsx, 2.xlsx etc) in a directory, on which I need to insert data from its corresponding text file (named 1.txt, 2.txt etc) on the second worksheet named 'Filtered' and save it. The code I am trying is #!/usr/bin/python import os from... (8 Replies)
Discussion started by: nans
8 Replies

2. Shell Programming and Scripting

Read csv file, convert the data and make one text file in UNIX shell scripting

I have input data looks like this which is a part of a csv file 7,1265,76548,"0102:04" 8,1266,76545,"0112:04" I need to make the output data should look like this and the output data will be part of text file: 7|1265000 |7654899 |A| 8|12660000 |76545999 |B| The logic behind the... (6 Replies)
Discussion started by: RJG
6 Replies

3. Programming

Read columns from text files

Dear All, I have basic structure of the C++ code . It suppose to read particular columns from some txt file. The txt file look like following (snippet). I have to ask the details for instance 'id' information for rows satisfying text with red color. The issue is that the txt file has not just the... (2 Replies)
Discussion started by: emily
2 Replies

4. Shell Programming and Scripting

Read text between regexps and write into files based on a field in the text

Hi, I have a huge file that has data something like shown below: huge_file.txt start regexp Name=Name1 Title=Analyst Address=Address1 Department=Finance end regexp some text some text start regexp Name=Name2 Title=Controller Address=Address2 Department=Finance end regexp (7 Replies)
Discussion started by: r3d3
7 Replies

5. Shell Programming and Scripting

Read n lines from a text files getting n from within the text file

I dont even have a sample script cause I dont know where to start from. My data lookes like this > sat#16 #data: 15 site:UNZA baseline: 205.9151 0.008 -165.2465 35.8109 40.6685 21.9148 121.1446 26.4629 -18.4976 33.8722 0.017 -165.2243 48.2201 40.6908 ... (8 Replies)
Discussion started by: malandisa
8 Replies

6. Shell Programming and Scripting

How to find empty files in a directory and write their file names in a text?

I need to find empty files in a directory and write them into a text file. Directory will contain old files as well, i need to get the empty files for the last one hour only. (1 Reply)
Discussion started by: vel4ever
1 Replies

7. Shell Programming and Scripting

how to read two text files in the same shell script

Folks i have written two scripts that do reading of csv files , i am currently fetching the all part of the line in to variables and braking the line into several variables. I am doing the same thing in an another shell script, i want to integrate both the scripts in to a single one where i can... (2 Replies)
Discussion started by: venu
2 Replies

8. UNIX for Dummies Questions & Answers

Read two text files in bash

Hi all, I have two files; file1.txt contains Jan Feb March file2.txt contains 01 02 03 How do i read the two files in a bash script so that it echos the following; Jan 01 Feb 02 Mar 03 (4 Replies)
Discussion started by: Muhammad Rahiz
4 Replies

9. Shell Programming and Scripting

How to make sure dir is really empty

Hi, I have this piece of shell script: #!/bin/ksh x=data1 x=data1 x=data1 for i in 1 2 3 do cp x $IN_DIR done PerformNextTask $IN_DIR is already designed to automatically pick up x and send x to other directory $OK_DIR. $IN_DIR will be empty once all x goes to $OK_DIR.... (2 Replies)
Discussion started by: luna_soleil
2 Replies

10. UNIX for Dummies Questions & Answers

Is there any non graphical tool that make selective merge between text files?

whitout using awk / sad and so on? (3 Replies)
Discussion started by: umen
3 Replies
Login or Register to Ask a Question