I am trying to write a script that would retrieve specific information from a template. I have been trying to no avail for the longest. This is what I wrote and it's not working.
cat filename | while read F5 F6
do
if [[ "$F5" = "a.RSSI" -a "$F6" ="p.RSSI" ]]
then
echo
$F5 $F6
fi
done
Here is the template (filename)
CN HR CR AF a.RSSI p.RSSI
CL01 00 01 01 2.07 4.20
Can someone tell me how to extract the info I am looking for. Your help is greatly appreciated.
./RSSI: a.RSSI=.RSSI: not found
./RSSI: p.RSSI=.RSSI: not found
I am not sure how to define a.RSSI and p.RSSI so that the program can read them. I added these two lines to the script, but it did not work. Somehow, I need to find a way to let the program read RSSI from the template and print its value.
Yeah, The syntax is correct. But for some reason, it is not reading the RSSI values. How can I define RSSI so that the script can read the RSSI values from the template?
Does anyone know another way of writing a script that extracts information from a template?
Thank you to all of you guys who posted an answer to my last inquiry. I have not been able to get back to this site for a while.
Anyway, I am trying to use the cut command do print a range of information from 1 to 87. The problem is when I use the following command line:
cd /dir/dir-data/logs/task
echo "info"
read info
read date
date=$date
d=`date +%y%m%d`
cd /dir/dir-data/logs/task
cgrep "$info" $date.task |cut -d ";" -f1-87 > /home/user/task/test/Data.$d
My cat Data.$d is empty. However, if I split my file into 4 files as follows, it works:
cgrep "$info" $date.task |cut -d ";" -f1-25 > /home/user/task/test/Data
1.$d
cgrep "$info" $date.task |cut -d ";" -f26-50 > /home/user/task/test/Data
2.$d
cgrep "$info" $date.task |cut -d ";" -f51-75 > /home/user/task/test/Data
3.$d
cgrep "$info" $date.task |cut -d ";" -f76-87 > /home/user/task/test/Data
4.$d
My question is if someone can tell me what I am doing wrong that keeps the command cgrep "$info" $date.task |cut -d ";" -f1-87 > /home/user/task/test/Data.$d from working properly. Maybe there are some restrictions with the cut command.
Every self-respecting Unix vendor ships their own pestering snake pit of braindead user-space utilities with arbitrary undocumented input and output limitations. Can you install GNU cut?
You could always simply try bigger and bigger values on a small file with just a few lines of test data and see if it just stops working at some particular amount of data. Usually multiples of 2 are good guesses; count bytes, fields, lines etc.