I am using ksh.
There is a report having amounts in the following format,
34343.67-
2343.45
23434.89-
I want to sum up all the amounts. For this I first need to find out if there is a minus sign at the end and prefix it before summing up. How to achieve this?
I thought of using an... (2 Replies)
Hello Experts,
I am new at this and need some help. I am looking for a delete command that allows me after I grep for the hostname to delete all the lines between two characters. for example I want to delete the first line all the way up to the } character
host test019 {
hardware ethernet... (10 Replies)
Hi,
The contents of my file is below:
Name,Location,Degree,Gender,Awards
Robert,Philadelphia,Accounting,Male,5
Jane,Chicago,Business,Female,2
Allan,New York,Engineering,Male,6
Tom,Detroit,Computer Science,Male,10
Nancy,Milwaukee,Engineering,Female,4
I want to add a "ID" in the 1st line... (2 Replies)
I have script as following..
server_status= some command | grep "Total error: 0"
if ; then
echo " Server $(hostname) is Down" >>Result
fi
else
echo " Server is OK on $(hostname)" >>Result
the if command seems to be not working properly for some... (13 Replies)
Hiiiiiiiiiiiii all,
Please i want your help fast, the teacher gave us this assignment can u help me to write it?
this is the question:
Write a shell script to point all prime numbers from the fibonacci series of integer N?
using Red hat Os
Thanks all and waiting for ur answers... (1 Reply)
hiiiiiiiiiiiii,,I found an error on my following script but couldnt find it!!! Can you please help me as soon as possible?!
echo "enter a number "
read n
i=0
first=0
second=1
result=0
prime="true"
echo –n " $first $second "
while
do
result=`expr $first + $second`
first=$second... (10 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Write a Bourne shell script which:
• Has one command line argument.
• If the command line argument is a... (5 Replies)
Hi all,
can you plz check whether the below code is correct & some inputs.
I need to read the below file and process it.
input :
/home/ibm/var.txt
urgent
not urgent
not needed.
#!/usr/bin/ksh
VAR=/home/ibm/var.txt
if ]
then (7 Replies)
As per code it is getting matched. not sure why it assigning to cols=0.
Any inputs please.
Input : passed is
shell.sh c tablename.
if ; then
cols=1
table=$2
else
cols=0
table=$1
fi (1 Reply)
Discussion started by: ramkumar15
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)