
Untitled
By: a guest on
Jun 21st, 2012 | syntax:
None | size: 0.51 KB | hits: 10 | expires: Never
If shell script file
if [ '/*, *, [3,5],/d' ]; then
echo 'ok'
else
echo'fail'
fi
#!/bin/bash
# tested with bash 4
while read -r x x Y x
do
case "$Y" in
"3," ) echo "ok";;
*) echo "Not ok";;
esac
done < file
#!/bin/sh
# let's create the input file
echo '5, 2, 3, 5' > /tmp/myfile
# function will output third argument
third() { IFS=', '; echo $3; }
# now let's print the third value from the input file
third $(cat /tmp/myfile)
#!/bin/sh
THIRD=$(awk -F', ' '{print $3}' < /tmp/myfile)