Sponsored Content
Top Forums Shell Programming and Scripting cut lines from log file and save it another file Post 302527934 by tonypalokkaran on Monday 6th of June 2011 04:55:34 AM
Old 06-06-2011
Bug cut lines from log file and save it another file

Dears,
i want cut the lines from a log file. Example of the log file as follows..

Code:
May 27, 2011 5:54:51 PM com.huawei.ivas.utilities.sm.client.SMDeliverContrUtil isDeliverSM[Line:171]
FINE: [IP :10.50.14.23][ThreadID :smpp01:Receiver-17130][ThreadName :][Module:SMS.Util][Content:Whether to control SM deliver max number:fals
e]
May 27, 2011 5:54:51 PM com.huawei.ivas.utilities.sm.client.SMUtil addSysUpMsgLog[Line:531]
INFO: [IP :10.50.14.23][ThreadID :smpp01:Receiver-17130][ThreadName :][Module:SMS.Util][Keyword:97478360][Content:receive up message from [97
478360]. The message content is [C].]
May 27, 2011 5:54:51 PM com.huawei.ivas.system.SMResourceCache assembleSMContent[Line:328]
INFO: [IP :10.50.14.23][ThreadID :http-0.0.0.0-8080-Processor2][ThreadName :[97478360||20110527175451|1762]][Content:assemble sms parameter,
phonenumber:97478360, operator:4, label:sm_delete_accepted.]
May 27, 2011 5:54:51 PM com.huawei.ivas.system.SMResourceCache assembleSMContent[Line:397]
INFO: [IP :10.50.14.23][ThreadID :http-0.0.0.0-8080-Processor2][ThreadName :[97478360||20110527175451|1762]][Content:User's brandId is -1 who
's phoneNumber is 97478360]
May 27, 2011 5:54:51 PM com.huawei.ivas.utilities.sm.client.SMUtil sendInfoMsg[Line:233]
FINE: [IP :10.50.14.23][ThreadID :http-0.0.0.0-8080-Processor2][ThreadName :[97478360||20110527175451|1762]][Content:The short message of typ
e [109006] will be notified in real-time.]
May 27, 2011 5:54:51 PM com.huawei.ivas.utilities.sm.kernel.DeviceSelector getDeviceListFor[Line:476]

In that, i want to cut the lines based on timestamp and want to save the result into another file.This files is copied and overwriting from another machine every day and i want to get the only those line which is created since last change.
Please help.

Last edited by radoulov; 06-06-2011 at 06:01 AM.. Reason: Code tags.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

cut a number of lines out of a file

Hi, I have a text file contaning around 150 lines, each line is a hostname. I want to read 4 lines/hostnames and save those 4 lines to a seperate file. say the big file is /files/bigfile and I want to have a lot of files in /files named /files/smallfile.1 , /files/smallfile.2 and so on... ... (1 Reply)
Discussion started by: networkfre@k
1 Replies

2. Shell Programming and Scripting

cut 11 lines from a file

All, I have a file that I want to read, cut 12 lines and direct into a new file, and continue to do this until I reach the EOF. How do I do it? can I use cat or read to do this? the file is formated with repetitive output consisting of these 12 lines date: <Timestamp> dev_id: <device ID>... (7 Replies)
Discussion started by: turk22
7 Replies

3. Shell Programming and Scripting

save every line in log file with matched string

i have been doing this script to match every line in a current log file (access_log) with strings that i list from a path (consist of 100 of user's name ex: meggae ).. and then make a directory of every string from the text file (/path/meggae/) --->if it matched.. then print every line from the... (3 Replies)
Discussion started by: meggae
3 Replies

4. Shell Programming and Scripting

cut lines in a file.

Hi Everyone, I have a file a.txt, inside is Mon Jul 20 00:05:07 2009 12 Mon Jul 20 00:05:08 2009 1 The output should be a.txt, inside is 00:05:07 12 00:05:08 1 My method is `cat a.txt | cut -f4,6 -d' ' > a.txt.tmp;mv -rf a.txt.tmp a.txt`; Is any good way to do this? like perl... (5 Replies)
Discussion started by: jimmy_y
5 Replies

5. Shell Programming and Scripting

Grep multiple lines and save to a file

Sir I have a data file e.g. DATA31082009. This file consists of several data files appended to that file. The size of each data file is different. The first line of each file starts with "44". I want to grep data from "44" to the preceding line of next "44" and save it as a individual file.... (10 Replies)
Discussion started by: chssastry
10 Replies

6. UNIX for Dummies Questions & Answers

cut particular lines from a file

how can I cut out partiluar lines like from line 233 to 347 ? any idea? (2 Replies)
Discussion started by: kvok
2 Replies

7. Shell Programming and Scripting

Pulling x number of lines from one file and save into another

Hi, I have a log file (updates.log), and I want to hunt the file for any errors. Here's an example of the log file: SQL> update <table1> set <value1> = '*****'; update <table1> set <value1> = '*****' * ERROR at line 1: ORA-00942: table or view does not exist Elapsed:... (4 Replies)
Discussion started by: dbchud
4 Replies

8. Shell Programming and Scripting

How to remove blank lines in a file and save the file with same name?

I have a text file which has blank lines. I want them to be removed before upload it to DB using SQL *Loader. Below is the command line, i use to remove blank lines. sed '/^ *$/d' /loc/test.txt If i use the below command to replace the file after removing the blank lines, it replace the... (6 Replies)
Discussion started by: vel4ever
6 Replies

9. Shell Programming and Scripting

Remove duplicate lines, sort it and save it as file itself

Hi, all I have a csv file that I would like to remove duplicate lines based on 1st field and sort them by the 1st field. If there are more than 1 line which is same on the 1st field, I want to keep the first line of them and remove the rest. I think I have to use uniq or something, but I still... (8 Replies)
Discussion started by: refrain
8 Replies

10. Shell Programming and Scripting

2 way to save a log file, what is the difference?

Hello good day I would like to know what is the difference between these two commands please both warrant the output in the file echo " ORACLE_SID : $ORACLE_SID" | tee -a $logfile echo " ORACLE_SID : $ORACLE_SID" > $logfile (3 Replies)
Discussion started by: tricampeon81
3 Replies
XML::Easy::Content(3pm) 				User Contributed Perl Documentation				   XML::Easy::Content(3pm)

NAME
XML::Easy::Content - abstract form of XML content SYNOPSIS
use XML::Easy::Content; $content = XML::Easy::Content->new([ "foo", $subelement, "bar", ]); $twine = $content->twine; DESCRIPTION
An object of this class represents a chunk of XML content, the kind of matter that can be contained within an XML element. This is in an abstract form, intended for general manipulation. It is completely isolated from the textual representation of XML, and holds only the meaningful content of the chunk. The data in a content object cannot be modified: different data requires the creation of a new object. An XML content chunk consists of a sequence of zero or more characters and XML elements, interspersed in any fashion. Character content can use almost all Unicode characters, with only a few characters (such as most of the ASCII control characters) prohibited by the specification from being directly represented in XML. Each XML element in a content chunk itself recursively contains a chunk of content, in addition to having attached metadata. This class is not meant to be subclassed. XML content is unextendable, dumb data. Content objects are better processed using the functions in XML::Easy::NodeBasics than using the methods of this class. CONSTRUCTOR
XML::Easy::Content->new(TWINE) Constructs and returns a new content chunk object with the specified content. TWINE must be a reference to an array listing the chunk's content in twine form (see "Twine" in XML::Easy::NodeBasics). The content is checked for validity, against the XML 1.0 specification, and the function "die"s if it is invalid. METHODS
$content->twine Returns a reference to an array listing the chunk's content in twine form (see "Twine" in XML::Easy::NodeBasics). The returned array must not be subsequently modified. If possible, it will be marked as read-only in order to prevent modification. $content->content Deprecated alias for the "twine" method. SEE ALSO
XML::Easy::Element, XML::Easy::NodeBasics AUTHOR
Andrew Main (Zefram) <zefram@fysh.org> COPYRIGHT
Copyright (C) 2008, 2009 PhotoBox Ltd Copyright (C) 2009, 2010, 2011 Andrew Main (Zefram) <zefram@fysh.org> LICENSE
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2011-11-16 XML::Easy::Content(3pm)
All times are GMT -4. The time now is 10:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy