![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help NEEDED urgently on exceutable file | jagan_kalluri | UNIX for Dummies Questions & Answers | 5 | 05-29-2008 04:06 PM |
| Need help urgently | user_prady | Shell Programming and Scripting | 3 | 09-03-2007 10:51 PM |
| Major Help Urgently Needed!!!! | billett05 | UNIX for Dummies Questions & Answers | 3 | 07-20-2005 03:55 PM |
| Need Information Urgently. | sumit_krishan | UNIX for Dummies Questions & Answers | 3 | 06-08-2005 07:13 AM |
| Shell Script needed urgently | vas_dba | Shell Programming and Scripting | 2 | 03-11-2005 09:00 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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
but the out put became the infinite loop of the first line as >> ALAIL; :command not found can any one do it waiting for reply soon ![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|