The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #7 (permalink)  
Old 02-08-2008
nabmufti nabmufti is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 15
Question extract string components from a file by BASH script

following the script i got here worked well in getting file input

Code:
#!/bin/bash
alarm= `cat ~/alkatel.txt`
echo $alarm | while read line
do
{
echo $line
} 
done
thanx 4 it

but will you plz help me in extracting the whole string following ! , !! or !!!
coz i can only extract just one letter at my best using code

the example of file im trying to extract strings is given above

more i am trying to use cut command to extract string components in file.
can i use this command to extract a complete log of alarm from file e.g.


!!! *A0628/303 /07-12-17/15 H 46/N=7501/TYP=COM/CAT=IM/EVENT=MAL
/NCEN=MULCT /AFUR =URAD- 4/AGEO=BUDLASAN-B01
/TEXAL=SINGLE JUNCT/UT OOS/COMPL.INF:
/CN=3

i want to extract the string in this way above
i used the command cut to extract date and time from the file as
Code:
cut -b 16-32 ~/alkatel.txt
but i got the output as

/07-12-17/15 H 46/
T /AFUR =URAD- 4


hope u will understand my problem

please read the threads above , to be sure about solution of my problem