hi all
i need help
I am confused and stucked. Actually i am new in this scripting stuff. I want to give complete txt file as a input to a variable and then sort the data in the file according to the alpha numeric characters, as my text file contains ! and !! and !!! indicating Minor, Major and Critical repectively. Each alpha numeric represent new entry. I am trying to do but all in vain, help needed plz,codes which i am trying are as follows,
[code]:
#!/bin/bash
alarmfile= `cat ~/alkatel.txt`
[\code]
i tried so many times but whenever i try to take file as input by code above but i got the output
>> : command not found
its a long file ,im sending a part of this text file that i want to take as input
example of file
>> ALAIL;
CMD ALAIL 06095 08-01-30 11-58-23
INP ALAIL 06095 08-01-30 11-58-23
OPTEX=
RES ALAIL 06095 08-01-30 11-58-24
CEN=1/08-01-30/11 H 58 MN 19/STORED ALARMS LIST
PROCESSING TPFFIR ACC
! *A0628/540 /07-12-17/15 H 58/N=7598/TYP=ICT/CAT=SI/EVENT=MAL
/NCEN=MULCT /AM =SMTA1/AGEO=S1-TR01-B03-A085-R000
/TEXAL=AIS/COMPL.INF:
/AF=URMA1
/ ICTRQ AGCA=S1-TR01-B03-A112-R065
/AMET=01-07-02
/AFLR=222-09/CRC=NACT
!!! *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
if i removed these >> operators from the start of file i again got the same output
ALAIL ; :command not found
even this file doesnt have executeable permission but still i am getting this message
i am so confused as i am still at my first step since 3 days
please help me, why it doesnt take the whole file as text input rather the first word and ignorin the rest of file
as i told befor ! & !!! showing minor & critical alarms.its a log file of alkatel switch & i have to extract
!!! , !! , !
with relevant
date & time e.g !!! */07-12-17/15 H 46/
event i.e. EVENT=MAL
& texal i.e. /TEXAL=SINGLE JUNCT/UT OOS/COMPL.INF
i collected stuff about reg exp from this site to take yhe substring but couldnt find a way still
let me make it very clear that i need this script in bash onlynot perl and any other language
i tried another script to extract entry components from the file as Code:
:
#!/bin/bash
var=~/alkatel.txt
while read line $var
do
{
echo $line
}done