Sponsored Content
Operating Systems Linux Please correct me with my code? Post 302477269 by hadimotamedi on Saturday 4th of December 2010 12:25:48 AM
Old 12-04-2010
Please correct me with my code?

Dear All
On my Linux server, I need to separate the individual logs coming from various modules concurrently. Please find below a sample of the logs:


Quote:
' IPTR >..
Read Subscript: 153 Write Subscript: 154 Port: 4972
Current time: Tue Nov 23 15:33:53 2010
Sent packet to 172.18.99.1 4972 #0
packet is 1081 bytes long, contains:
30 82 04 35 02 01 01 04 06 70 75 62 6C 69 63 A7 82 04 26 02 01 01 02 01 FF 02 0107 30 82 04 19 30 82 04 15 06 0F 2B 06 01 04 01 8A 5D 01 03 03 04 02 07 AE 0B 0482 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 00

SNMP >..

local:4972 ==> 172.18.99.1:4972 Type=Trap-V2, RID=136337360, Error=255, Bind=1[37m
oid[0]=1.3.6.1.4.1.1373.1.3.3.4.2.7.5899, vartype=04, msglen=1024

local:4969 ==> 172.18.99.1:4969 Type=Trap-V2, RID=1, Error=80, Bind=1[37m
oid[0]=1.3.6.1.4.1.1373.1.3.3.8.2.7.779, vartype=04, msglen=1024

HLR >..

HLR recv <- DELIM ind
Dialogue id:1927'
As you see, each log begins with its modules name that I need to separate its individual log. So I have wrote the following code to separate it:
#cat Edit3 | tr -d "\r" | while read LINE; do
>echo "$LINE" | grep -q '>\.\.'
>if [ $? -eq 0 ]; then
>LOGFILE=`echo $LINE | cut -d' ' -f1`.log
>else
>echo "$LINE" >> $LOGFILE
>fi
>done
But when I run it, I am receiving the following error:
Code:
-bash: -f1.log : command not found
-bash: $LOGFILE : ambiguous redirect

Can you please help me to correct my code?
Thank you
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can any body correct the code

#!/bin/ksh LOG_DATE=`date +%Y%m` export LOG_DATE cd D:/Informatica/Informatica_share/SrcFiles/l # mv SITE_ACTIVITY${LOG_DATE}*.CSV D:/Informatica/Informatica_share/SrcFiles/SITE_ACTIVITY${LOG_DATE}*.CSV # mv SITE_ACTIVITY20050914114546.CSV... (6 Replies)
Discussion started by: vivekanandarpat
6 Replies

2. UNIX for Advanced & Expert Users

can any body correct the code

#!/bin/ksh LOG_DATE=`date +%Y%m` export LOG_DATE cd D:/Informatica/Informatica_share/SrcFiles/l # mv SITE_ACTIVITY${LOG_DATE}*.CSV D:/Informatica/Informatica_share/SrcFiles/SITE_ACTIVITY${LOG_DATE}*.CSV # mv SITE_ACTIVITY20050914114546.CSV... (2 Replies)
Discussion started by: vivekanandarpat
2 Replies

3. Shell Programming and Scripting

Please correct the code

Hi, Some part of output: ================ $ hwmgr show scsi SCSI DEVICE DEVICE DRIVER NUM DEVICE FIRST HWID: DEVICEID HOSTNAME TYPE SUBTYPE OWNER PATH FILE VALID PATH ------------------------------------------------------------------------- 68: ... (10 Replies)
Discussion started by: mansa
10 Replies

4. Shell Programming and Scripting

Please correct this

I have input file like this Input file: ABC|abc_etc_passwd XYZ|XYZ_etc_passwd zXY|XYZ_etc_passwd IJK|test_etc_passwd KLM|test_etc_passwd i want to do following in a loop. grep 'ABC' *abc_etc_passwd* grep 'XYZ' *XYZ_etc_passwd* grep 'ZXY' *ZXY_etc_passwd* i have tried this for i... (2 Replies)
Discussion started by: pinnacle
2 Replies

5. Solaris

in correct drive name

I am new to solaris and I replaced a faulty tape drive sun DLT7000 But, I am getting the follwoing error when system reboots ltid deamon error drive index 1 is not correct, drive name /dev/rmt/2cbn is incorrect no such file or directory. I have two drives the other one is /dev/rmt/0cbn,... (8 Replies)
Discussion started by: latif1958
8 Replies

6. Shell Programming and Scripting

Please Correct My script

############### #filename.sh ############### CUREENT_DATE=02 log_file_path="$CUREENT_DATE"-"${0##%*/}`|cut -d "." -f1|awk -F "/" '{print $NF}'`"".log" echo $log_file_path ################ #output required 02-filename.log (6 Replies)
Discussion started by: mohitmehral
6 Replies

7. Shell Programming and Scripting

Send correct exit code from child script back to parent

Hello all; hope someone can help me cause I am going crazy trying to find a solution for (what I think is simple) issue...looked hard up and down this forum and tried several "solutions" with no avail...so here's my issue: I have this (parent) script: copylsofdcmcadefttosftpwithmove.sh ... (3 Replies)
Discussion started by: gvolpini
3 Replies

8. Shell Programming and Scripting

Help to correct dnsscript.

Hello Brains, I was trying to develop a script that would do nslookup using both name and ip of server and format the output and store in an output file. Please find the script below. #!/usr/bin/ksh cat $1 | tr "" "" | while read ip name do ERROR="$(nslookup $ip | grep can't | awk -F"... (2 Replies)
Discussion started by: Praveen P
2 Replies

9. Shell Programming and Scripting

How to correct this awk code without eval?

Hi everyone, The following piece of awk code works fine if I use eval builtin var='$1,$2' ps | eval "awk '{print $var}'" But when I try to knock off eval and use awk variable as substitute then I am not getting the expected result ps | awk -v v1=$var '{print v1}' # output is $1,$2 ps |... (4 Replies)
Discussion started by: royalibrahim
4 Replies

10. Shell Programming and Scripting

Same sed code prints(p) correct, but writtes(w) wrong output

Dear all, I am using sed as an alternative to grep in order to get a specific line from each of multiple files located in the same directory. I am using sed because it prints the lines in the correct order (unlike grep). When I write sed code that prints out the output I get it correct, but... (1 Reply)
Discussion started by: JaNaJaNa
1 Replies
COMSAT(8)						    BSD System Manager's Manual 						 COMSAT(8)

NAME
comsat -- biff server SYNOPSIS
comsat DESCRIPTION
Comsat is the server process which receives reports of incoming mail and notifies users if they have requested this service. Comsat receives messages on a datagram port associated with the ``biff'' service specification (see services(5) and inetd(8)). The one line messages are of the form: user@mailbox-offset If the user specified is logged in to the system and the associated terminal has the owner execute bit turned on (by a ``biff y''), the offset is used as a seek offset into the appropriate mailbox file and the first 7 lines or 560 characters of the message are printed on the user's terminal. Lines which appear to be part of the message header other than the ``From'' or ``Subject'' lines are not included in the output. FILES
/var/run/utmp to find out who's logged on and on what terminals SEE ALSO
biff(1), inetd(8) BUGS
The message header filtering is prone to error. The density of the information presented is near the theoretical minimum. Users should be notified of mail which arrives on other machines than the one to which they are currently logged in. The notification should appear in a separate window so it does not mess up the screen. Please report bugs to netbug@ftp.uk.linux.org and include diffs/patches, compiler error logs or as complete a bug report as you are able. HISTORY
The comsat daemon appeared in 4.2BSD. Linux NetKit (0.17-pre-20000412) July 31, 1999" Linux NetKit (0.17-pre-20000412)
All times are GMT -4. The time now is 11:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy