2011年10月14日 星期五

[Linux][Bash][Read Line to Get Each Element]

#!/bin/sh 

while read inputline 
do 
    RSUBDIR="$(echo $inputline | cut -d: -f1)" 
    VOL="$(echo $inputline | cut -d: -f2)" 
    
    echo RSUBDIR = $RSUBDIR and VOL = $VOL 
done < FILE_RSUBDIR_VOL

and file FILE_RSUBDIR_VOL is below

200808:20                                                            
200654:19
200387:18
200244:17

I am still trying to figure out how to distinguish different separators.

沒有留言:

張貼留言