Hi
I need some suggestion on glob function.
I am trying to write a python program to grep some specific files in a particular directory.
In the directory i have some files like below
abc.log
abc.pid
abc.tar
gadd.tar
gat.log
gat.tar
in this directory i need to grep onlu my hostname files, my host name is abc, so the output should be
abc.log
abc.pid
abc.tar
I have written the program as below
Please help me how to fill glob.glob line in the above coding
Hi,
Can someone please clarify how we are able to use both IO and GLOB symbols of a package variable interchangeably?
Please consider the following code:
open(FH,"myfile") || die "Unable to open file myfile:$@";
my $glob_var = *main::FH{GLOB};
my $io_var = *main::FH{IO};
print $glob_var... (0 Replies)
Hi All,
I have to upgrade python installed on my Redhat enterprise Linux 4. I downloaded the latest python package from python website but not able to install the new package as the make command itself goes on running for more than a day. Can some help me regarding this. Is ther any method to... (2 Replies)
Hi Experts,
I am designing a web page in Python that shows a graphical representation of the load on the various computing nodes of the Linux server. I am currently using ReportLab to generate the charts and graphs, but I seem to have some problems with that. I've reviewed ChartDirector. It... (2 Replies)
I encountered a weird issue with globbing in perl not returning all files, while I was testing out a script for recursive dir-processing on my Synology NAS.
Basically it didn't show (/match?) all the files in a specific directory. If I move the file to a different directory or even rename it, it... (2 Replies)
If you have a look at this thread, you'll see that users have been posting the output a script which are numbers that range from 2 to 5 decimal places. If I dump this entire thread to txt file, how can I:
1) Delete everything except for numbers of the following formats (where 'x' is a digit and... (5 Replies)
Hi
I Have a directory and i have some files below
abc.txt
abc.gif
gtee.txt
ghod.pid
umni.log
unmi.tar
How can use glob function to grep abc files , i have created a variable "text" and i assigned value as "abc", please suggest me how can we use glob.glob( ) to get the output as below... (2 Replies)
I would like to know how or if I could use python packages/libraries meant for linux on windows. In particular there is a soya3d game engine for python but I can only find downloads for linux. Yet I want to create programs with it that work on windows. (python 3) (1 Reply)
I used this site to check a script.
ShellCheck - shell script analysis tool
Line 57:
zip -u -q Desktop_Items.zip *.desktop
^-- SC2035: Use ./*glob* or -- *glob* so names with dashes won't become options.
I do not understand what is wrong with my zip... (6 Replies)
Hi all,
I am trying to run below python code for connecting remote windows machine from unix to run an python file exist on that remote windows machine..
Below is the code I am trying:
#!/usr/bin/env python
import wmi
c = wmi.WMI("xxxxx", user="xxxx", password="xxxxxxx")... (1 Reply)
Hello All,
I have created a script that searches for different things and "sanitizes" the findings from files. Currently the user is required to put in a hostname (server.serverfarm.abc) one at a time to replace. I would like the user be able to use *.*.abc in grep and then pipe into sed to... (1 Reply)
Discussion started by: jvezinat
1 Replies
LEARN ABOUT LINUX
unbuffer
UNBUFFER(1) General Commands Manual UNBUFFER(1)NAME
unbuffer - unbuffer output
SYNOPSIS
unbuffer program [ args ]
INTRODUCTION
unbuffer disables the output buffering that occurs when program output is redirected from non-interactive programs. For example, suppose
you are watching the output from a fifo by running it through od and then more.
od -c /tmp/fifo | more
You will not see anything until a full page of output has been produced.
You can disable this automatic buffering as follows:
unbuffer od -c /tmp/fifo | more
Normally, unbuffer does not read from stdin. This simplifies use of unbuffer in some situations. To use unbuffer in a pipeline, use the
-p flag. Example:
process1 | unbuffer -p process2 | process3
CAVEATS
unbuffer -p may appear to work incorrectly if a process feeding input to unbuffer exits. Consider:
process1 | unbuffer -p process2 | process3
If process1 exits, process2 may not yet have finished. It is impossible for unbuffer to know long to wait for process2 and process2 may
not ever finish, for example, if it is a filter. For expediency, unbuffer simply exits when it encounters an EOF from either its input or
process2.
In order to have a version of unbuffer that worked in all situations, an oracle would be necessary. If you want an application-specific
solution, workarounds or hand-coded Expect may be more suitable. For example, the following example shows how to allow grep to finish pro-
cessing when the cat before it finishes first. Using cat to feed grep would never require unbuffer in real life. It is merely a place-
holder for some imaginary process that may or may not finish. Similarly, the final cat at the end of the pipeline is also a placeholder
for another process.
$ cat /tmp/abcdef.log | grep abc | cat
abcdef
xxxabc defxxx
$ cat /tmp/abcdef.log | unbuffer grep abc | cat
$ (cat /tmp/abcdef.log ; sleep 1) | unbuffer grep abc | cat
abcdef
xxxabc defxxx
$
BUGS
The man page is longer than the program.
SEE ALSO
"Exploring Expect: A Tcl-Based Toolkit for Automating Interactive Programs" by Don Libes, O'Reilly and Associates, January 1995.
AUTHOR
Don Libes, National Institute of Standards and Technology
1 June 1994 UNBUFFER(1)