This is a discussion on [file.handling] problem within the Shell scripting forums, part of the Development/Scripting category; Hi! I want to write a script which reads and writes some data from files. Here it goes: Code: #!/bin/sh ...
|
|||||||
| Register | FAQ | Members List | Calendar | Forgotten your password? | Mark Forums Read |
|
|||
|
Hi!
I want to write a script which reads and writes some data from files. Here it goes: Code:
#!/bin/sh
echo `gsh list_atm_vc -eq { 2 11 2 1 } > list_atm_vc.txt`
mFile="list_atm_vc.txt"
echo `wc -l list_atm_vc.txt > temp`
read num rest < "temp"
PORT=""
VPI=""
VCI=""
i="1"
while [ 1 ]
do
if [ "$i" = "0" ]; then
read PORT VPI VCI || break
echo `gsh get_atm_vc -eq { 2 11 2 1 } -port $PORT -vpi $VPI -vci $VCI`
fi
i=`expr $i + 1`
done < $mFile
rm $mFile
rm $tFile
Following command: Code:
echo `gsh list_atm_vc -eq { 2 11 2 1 } > list_atm_vc.txt`
Code:
Port VPI VCI 0 0 101 0 0 100 Code:
echo `gsh get_atm_vc -eq { 2 11 2 1 } -port $PORT -vpi $VPI -vci $VCI`
To overlook first and last line form above mentioned line I check number of lines with command: Code:
echo `wc -l list_atm_vc.txt > temp` My problem is that I can't figure out, how to get this number of lines (get errors or no data in variable The output of above command is: Code:
4 list_atm_vc.txt To sum up... I'd like to: 1. Invoke a command which gives an output 2. Check number of lines of above output 3. Invoke another command with parameters read from lines, EXCEPT first and last line. Thanks for any idea... -- fahur |
| Sponsored Links | ||
|
|
|
|||
|
Quote:
Quote:
Code:
Sun Microsystems Inc. SunOS 5.8 Generic Patch October 2001 -- fahur |
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Read arguments from a file and pass them to binary file | AHJ | Shell scripting | 1 | 10-31-2007 07:04 PM |
| Problem blocking file ext downloads from Gmail in squid | Roshu | Networking, Firewalls and Security | 1 | 08-25-2007 12:21 AM |
| /etc/crontab file permissions or ownership can cause problem | chiku | Linux software | 2 | 12-20-2006 02:57 AM |
| convert pdf (ppt file) into wordppt file | sureshbup | Linux software | 1 | 12-07-2006 04:51 PM |