03-28-2015
Since bash cannot handle floating numbers, i'd let awk do the compare with 0.28, and print a 0 if so, and a 1 if not, into a variable.
Then compare that variable with 0 or 1 in your if block.
hth
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi
I am writing a bash script that uses dialog to get user input an diplay messages to user. I have a small problem
dialog --inputbox "blabla" 20 50 2> /tmp/output
VAR="'cat /tmp/output'"
mkdir $VAR
the code below requests user for a directory path to be created.
But, if the user uses... (1 Reply)
Discussion started by: fnoyan
1 Replies
2. UNIX for Advanced & Expert Users
I need to detect the number of pages in a print job when it is available so I can warn users when they try to print a report much larger than they expected. Sometimes they are trying to print 1000 page reports when they thought they were getting a 10 page report.
Under linux I am scanning the... (5 Replies)
Discussion started by: Max Rebo
5 Replies
3. Shell Programming and Scripting
Hi everybody!
I have written some awk scripts that return me some results I need to process. At the moment I use openOffice to process them, but I am trying to find a more efficient solution using possibly a bash or awk script.
I have two files, file1 is in the format:
time position
... (3 Replies)
Discussion started by: Alice236
3 Replies
4. Shell Programming and Scripting
I have written a script and I get error and I don't understand why.
neededParameters=2
numOfParameters=0
correctNum=0
while getopts "s:l:" opt
do
case "$opt" in
s)
serviceName= $OPTARG #errorline 1
numOfParameters= $numOfParameters + 1
;;
l)
... (12 Replies)
Discussion started by: programAngel
12 Replies
5. Shell Programming and Scripting
hi to everyone :)
i am new to linux and bash and i am trying to build a bash script, that is quite similar to the well known cmd 'split' ... ;)
it is now already "working" ... i can use it like:
./splitfix.sh -v -s 10 foo
./splitfix.sh -s 10 -v foo
./splitfix.sh -s 10 foo
./splitfix.sh -v... (5 Replies)
Discussion started by: drjodo
5 Replies
6. Shell Programming and Scripting
This is the final first release of the dynamic menu generator for pekwm (WM).
#!/bin/bash
function param_val {
awk "/^${1}=/{gsub(/^${1}="'/,""); print; exit}' $2
}
echo "Dynamic {"
for CF in `ls -c1 /usr/share/applications/*.desktop`
do
name=$(param_val Name $CF)
... (3 Replies)
Discussion started by: alexscript
3 Replies
7. Shell Programming and Scripting
Hi guys!
I'm new to the forum and to the Bash coding scene.
I have the following code
paths=/test/a
paths=/test/b
keywords=\"*car*\"
keywords=\"*food*\"
for file in `find paths -type f -ctime -1 -name keywords -print 2>/dev/null`
do
#.... do stuff here for every $file found... (5 Replies)
Discussion started by: RedSpyder
5 Replies
8. Shell Programming and Scripting
Hi,
Below is my bash script:
cat run_all.sh
if && ; then
Number_Count_Program $1.results $2.results > $1.$2.counts
else
Number_Split_Program $1.results $2.results > $1.$2.split
fi
After I run the following command:
./run_all.sh A B
./run_all.sh: line 1:
Anybody advice to edit... (5 Replies)
Discussion started by: perl_beginner
5 Replies
9. UNIX for Dummies Questions & Answers
Hi!
I have a new problem with awk, this time I think is because I'm using it in bash and I don't know how to put the valor of the variable in awk. Here is the code:
#!/bin/bash
for i in 1 2 3 4 5
do
a=$i
b=$
awk '$1>=a&&$1<=b {print $1,$2,$3}'>asdf test... (3 Replies)
Discussion started by: florpi
3 Replies
10. Shell Programming and Scripting
Hi everyone,
I'm trying to write a small script to automatize row data treatment. However, I got some trouble with the awk command.
I want to use awk to extract a define paragraph from a text file. The first and final lines are defined externally in two variables called debut and fin.
I... (2 Replies)
Discussion started by: TeaTimeSF
2 Replies
PASTE(1) General Commands Manual PASTE(1)
NAME
paste - paste multiple files together
SYNOPSIS
paste [-s] [-d list] file...
OPTIONS
-d Set delimiter used to separate columns to list.
-s Print files sequentially, file k on line k.
EXAMPLES
paste file1 file2 # Print file1 in col 1, file2 in col 2
paste -s f1 f2 # Print f1 on line 1 and f2 on line 2
paste -d : file1 file2
# Print the lines separated by a colon
DESCRIPTION
Paste concatenates corresponding lines of the given input files and writes them to standard output. The lines of the different files are
separated by the delimiters given with the option -s. If no list is given, a tab is substituted for every linefeed, except the last one.
If end-of-file is hit on an input file, subsequent lines are empty. Suppose a set of k files each has one word per line. Then the paste
output will have k columns, with the contents of file j in column j. If the -s flag is given, then the first file is on line 1, the second
file on line 2, etc. In effect, -s turns the output sideways.
If a list of delimiters is given, they are used in turn. The C escape sequences
, , \, and are used for linefeed, tab, backslash,
and the null string, respectively.
PASTE(1)