07-14-2008
Whats wrong with this line?
I have a file $I_FILE that I need to filter and store the 1st and the 9th columns in another file $O_FILE.
With this in Perl,
system ("awk -F, '{print \$1, \$9}' \$I_FILE | sed '\/^\$\/d' > O_FILE");
I get:
4096045055
The first line in I_FILE is:
4294967295,0,3,2103159,54668771,54668771,0,3233,566547,28,18,12
so it should print:
4294967295 566547
in o_file.
Thanks!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
while read LINE;
do
echo |awk -v LIN="${LINE}" '{print substr(LIN,1,7)","substr(LIN,8,5)" ,"substr(LIN,14,10)","substr(LIN,24,6)" ,"substr(LIN,30,8)}';
done < exp1.txt
exp1.txt = 1234 grgrg 203902 ksdjh oehr weo
why it doesn't work??
thanks. (5 Replies)
Discussion started by: george_
5 Replies
2. Shell Programming and Scripting
Hi
#!/bin/sh
user=$1
if " -eq 0 ]
echo "No"
else
echo "Yes"
fi
I'm not quite sure whats wrong with this but I know its something silly.
Any ideas?
Thanks (9 Replies)
Discussion started by: c19h28O2
9 Replies
3. Shell Programming and Scripting
Hi all,
#!/bin/ksh
BIN=/interface/Gunner
age=$1
directory="$2"
&& directory=.
cd "$directory" || exit 1
from=`$BIN/today -$age`
cd $BIN
for i in `cat filestoarchive.txt`;do
cd $i
find . -mtime 14 | grep -v '.tar$' | $BIN/dttmfilter | awk '$1<="'$from'"{ print;};' | \
done (2 Replies)
Discussion started by: kayarsenal
2 Replies
4. Shell Programming and Scripting
#! /bin/bash
head -5 $1
echo "remove $1 ?"
read answer
if
then
echo invalid answer
elif
rm $1
echo "$1 is deleted"
elif
then
echo file is not deleted
else
echo "invalid answer"
fi
What i really want this to do is to ask to delete the file or not..it says something wrong... (1 Reply)
Discussion started by: nadman123
1 Replies
5. Shell Programming and Scripting
#! /bin/bash
USAGE=" | ]
if
then
echo "$USAGE"
exit 1
fi
while getopts lb: OPTION
do
case $(OPTION)in
a) echo Hi there!
exit 2;;
b) echo hello
o) OARG=$OPTARG;;
\?)echo "$USAGE" ;;
exit 2;;
esac
done
shift `expr... (1 Reply)
Discussion started by: nadman123
1 Replies
6. Shell Programming and Scripting
E:\>perl -00ne 'push @a,"$_\0$ARGV\n";END{print reverse split/\0/ for sort @a}' file1-obj_prof.out.txt file2-obj_prof.out.txt'
Can't find string terminator "'" anywhere before EOF at -e line 1. (6 Replies)
Discussion started by: richsark
6 Replies
7. UNIX for Dummies Questions & Answers
can anyone tell me why this code doesn't work how its supposed to, its the hangman game but it doesn't play how its supposed to
#!/bin/bash
NoAttempts="0"
livesgiven="5"
LivesRemain=$livesgiven
LettersAttempted=""
wordfile=words
numwords=0
function menu()
{
clear
cat << menu... (1 Reply)
Discussion started by: ferrycorsten73
1 Replies
8. Shell Programming and Scripting
Need your assistance, to find the bug in the function.
Function usage erroring out even after passing parameters.
usage() {
if || ; then
echo "************************************************************"
echo " CHECK USAGE FOR CORRECT PARAMETERS ... (26 Replies)
Discussion started by: raghunsi
26 Replies
9. Homework & Coursework Questions
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:
ls -ld htdocs
drwxr-x--- 3 root root 8192 2006-11-19 10:41 htdocs
How would a host administrator... (1 Reply)
Discussion started by: Larry_1
1 Replies
10. UNIX for Dummies Questions & Answers
hi whats wrong in below??
CHECK=M10;
if ;
then
echo "hello hi";
else
echo "how are u hello hi";
fi
I am getting error as
./test.sh: line 2: '
./test.sh: line 2: M10: command not found
./test.sh: line 2: M10: command not found
./test.sh: line 2: M10: command not found (8 Replies)
Discussion started by: skyineyes
8 Replies
LEARN ABOUT OPENSOLARIS
mlib_imagecolorhsl2rgb
mlib_ImageColorHSL2RGB(3MLIB) mediaLib Library Functions mlib_ImageColorHSL2RGB(3MLIB)
NAME
mlib_ImageColorHSL2RGB - HSL to RGB color conversion
SYNOPSIS
cc [ flag... ] file... -lmlib [ library... ]
#include <mlib.h>
mlib_status mlib_ImageColorHSL2RGB(mlib_image *dst, const mlib_image *src);
DESCRIPTION
The mlib_ImageColorHSL2RGB() function performs a conversion from hue/saturation/lightness to red/green/blue. The source and destination
images must be three-channel images.
It uses the following equations:
L' = L if L <= 1/2
L' = 1 - L if L > 1/2
V = L + S*L'
P = L - S*L'
Q = L + S*L'*(1 - 2*fraction(H*6))
T = L - S*L'*(1 - 2*fraction(H*6))
R, G, B = V, T, P if 0 <= H < 1/6
R, G, B = Q, V, P if 1/6 <= H < 2/6
R, G, B = P, V, T if 2/6 <= H < 3/6
R, G, B = P, Q, V if 3/6 <= H < 4/6
R, G, B = T, P, V if 4/6 <= H < 5/6
R, G, B = V, P, Q if 5/6 <= H < 1
where 0 <= H < 1 and 0 <= S, L, L', V, P, Q, T, R, G, B <= 1.
Assuming a pixel in the source image is (h, s, l) and its corresponding pixel in the destination image is (r, g, b), then for MLIB_BYTE
images, the following applies:
H = h/256
S = s/255
L = l/255
r = R*255
g = G*255
b = B*255
for MLIB_SHORT images, the following applies:
H = (h + 32768)/65536
S = (s + 32768)/65535
L = (l + 32768)/65535
r = R*65535 - 32768
g = G*65535 - 32768
b = B*65535 - 32768
for MLIB_USHORT images, the following applies:
H = h/65536
S = s/65535
L = l/65535
r = R*65535
g = G*65535
b = B*65535
and for MLIB_INT images, the following applies:
H = (h + 2147483648)/4294967296
S = (s + 2147483648)/4294967295
L = (l + 2147483648)/4294967295
r = R*4294967295 - 2147483648
g = G*4294967295 - 2147483648
b = B*4294967295 - 2147483648
PARAMETERS
The function takes the following arguments:
dst Pointer to destination image.
src Pointer to source image.
RETURN VALUES
The function returns MLIB_SUCCESS if successful. Otherwise it returns MLIB_FAILURE.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Committed |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
SEE ALSO
mlib_ImageColorHSL2RGB_Fp(3MLIB), mlib_ImageColorRGB2HSL(3MLIB), mlib_ImageColorRGB2HSL_Fp(3MLIB), attributes(5)
SunOS 5.11 12 Sep 2007 mlib_ImageColorHSL2RGB(3MLIB)