Hi.
I have a log file which gets updated by a java process and it uses ASCII STX and ETX characters (i.e CTRL-B and CTRL-C characters) to demarcate each XML message logged.
so the format of the file is something like
each XML message spans multiple lines as shown in ...
I dont have control over the process which writes these log files. I now need to write a utility which reads from one of these files and extract each XML message. While doing this i came up with this issue when using tail function.
so basically i did something like
and then after sometime compared the out_file to the original file. I noticed that some parts of some messages are missing. and they are replaced by ASCII NUL characters.
Looks like i only get this issue when the file is getting updated by new content. If i did
, then i cant find any weird NUL characters and also the two files compare to be the same in content.
Looks like the issue is something to do with control characters - the STX and ETX. but then i am not in control of this file and i need some way of reading it and processing it. Initially i wrote a java program to do it and used Java IO API. but then when i got these NUL characters , i went and tried tail, which then gave me the same issue.
I am running the tail from a SunOS machine :
SunOS <host_name> 5.10 Generic_142901-08 i86pc i386 i86pc
and the file i am tailing is in a NAS storage and mounted using NFS.
Appreciate any help in trying to resolve this issue.
Thanks corona688 for your reply. yes, i know tail shouldn't modify the data going thru it. strange.
I dont have hexdump utility.
the characters are 2 and 3 in HEX
which maps to ASCII STX and ASCII ETX.
od -A n -t x1 <file>
gave following:
02 XX XX XX XX
XX 03 02 XX XX
XX XX XX XX XX
03 02
etc.
XX are the data which are not 02 or 03 but valid ASCII characters.
I have a perl script which splits a large file into chunks.The script is given below
use strict;
use warnings;
open (FH, "<monolingual.txt") or die "Could not open source file. $!";
my $i = 0;
while (1) {
my $chunk;
print "process part $i\n";
open(OUT, ">part$i.log") or die "Could... (4 Replies)
Hi Folks -
I'm trying to extract the string between two special characters, the "-" and "." symbols.
The string format is as such:
_PBCS_URL_PRD=https://plan-a503777.pbcs.us6.ocloud.com
_PBCS_URL_TST=https://pln-test-a503777.pbcs.us6.ocloud.comIn the above case, I need to extract "a503777".... (7 Replies)
Hi
Please help me in finding a solution for tailing multiple log files and writing all of them into one common file.
I have 4 log files with same name in 4 different folders.
Whenever I post a Request - any one of these 4 log files gets updated with some log detail in the below format :
... (5 Replies)
my current code:
varA=$(tail -200 /var/log/data.txt | egrep -c "Capital|capitol")
varB=$(tail -200 /var/log/data.txt | egrep -c "State|Country")
varC=$(tail -200 /var/log/data.txt | egrep -c "City|Town")
I want to do this a different way. something like:
AllVars=$(echo $(tail -200... (5 Replies)
I have a log file which contains data like this
This log file is updated twice a day at 7am and 6pm,
I want a script(which i will make run at 7:10am and 6:10pm) which should fetch only the last appended lines since last update..
I mean.. if i execute the script at 7.10am 3/3/2010
it... (4 Replies)
Guys,
I do have a script that runs to take the server out from network, after running the script it is writing the new log file{outFile} in to directory . Now what i need is my script should tail the last modified file{outFile} & search the string {Server Status} ans should echo the same at the... (0 Replies)
Hi
Could anybody tell me how to count the number of occurances of a character within a LINE.
actually i have a single line with words seperated with '+' chracter e.g.
abc+def+ghj+jkl+asd
i want to separte the words above.
Please provide the necessary logic in the form of a SHELL... (6 Replies)
what can I use ??
In vi, I can use :set list <-- and see end of line $.. or use cat -A but I am wondering if there is command or program that allows me to see all the hidden characters( space, tab and etc)
Please help
thanks. (3 Replies)
Hi
I'd like to achieve the ff functionality;
tail -f log | grep keyword ...... and then perform a function.
That is, I like to tail a log and when a certain keyword appears I then want my script to play an audio file for example.
Any ideas??
Cheers
M (1 Reply)