Quote:
Originally Posted by scorpio
Hi all,
0680046755000011 3040249 3005930 60180GPRS4Samsung_SGH_Z500
This is the format of my log file and parameters for log file are like
• 10 first characters: MSISDN
• 6 next characters: Hour
• 18 next characters: ID SA Source
• 18 next characters: ID SA Destination
I have 11 whitespaces in between my first and second colums.I need to cut fitst 10 char next 6 char and next 18 char(including white spaces) . and i tried follwing in my code
MSISDN=`echo $data | cut -c1-10`
HOUR=`echo $data | cut -c11-16`
ID_SA_SOURCE=`echo $data | cut -c17-35`
ID_SA_DEST=`echo $data | cut -c36-54`
But becos of whitespaces it is not cutting properly.. can any one suggest alternatives
Thnks
|
First reduce the spaces in between the log file data with the command tr
Code:
HOUR=`echo $data | tr -s " " |cut -c11-16`