![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Blitz templates for PHP 0.5.10 (Default branch) | iBot | Software Releases - RSS News | 0 | 01-25-2008 10:00 PM |
| Where are SAM user templates stored? | paqman | HP-UX | 5 | 07-23-2007 01:31 PM |
| Templates | him | Post Here to Contact Site Administrators and Moderators | 2 | 10-17-2002 01:53 PM |
| site templates? | solvman | High Level Programming | 1 | 01-01-2002 12:13 AM |
| c++ templates problems in g++ | Marhinado John | High Level Programming | 3 | 09-28-2001 03:25 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Reading from Templates
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. Thanks! |
|
||||
|
I keep getting the following error message:
./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. a.RSSI=$a.RSSI p.RSSI=$p.RSSI Thanks for the help! |
|
||||
|
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? |
|
||||
|
Cut command
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. Thanks for the help. E. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|