Search Results

Search: Posts Made By: grc
19,767
Posted By radoulov
% cat display_range.sh #!/bin/sh sed -n...
% cat display_range.sh
#!/bin/sh

sed -n "$1,${2}p" "$3"
% chmod u+x display_range.sh
% print -l {1..10} > infile
% cat infile
1
2
3
4
5
6
7
8
9
10
% ./display_range.sh 3 7 infile...
19,767
Posted By radoulov
Just use sed: % min=3 max=5 % sed -n...
Just use sed:

% min=3 max=5
% sed -n $min,${max}p infile
19,767
Posted By jim mcnamara
sed -n '3,5p' filename
sed -n '3,5p' filename
1,736
Posted By Scott
Hi. You missed some spaces... ...
Hi.

You missed some spaces...


#!/bin/bash
x=5
while [ $x -ge 1 ] # <-- space after [ and before ]
do
echo $x
x=`expr $x - 1`
echo ""
done
echo ""
Also,...
3,568
Posted By dr.house
How about: echo $a/$b | bc -l
How about:

echo $a/$b | bc -l
3,568
Posted By Scott
I had no idea that this would work: $ a=1...
I had no idea that this would work:


$ a=1
$ b=2
$ echo $[a+b]
3

Weird, but I learnt something new!

Not sure that this will work:

4) echo `$[a/b]| bc -l `;;


Might need to be more...
Showing results 1 to 6 of 6

 
All times are GMT -4. The time now is 08:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy