Sponsored Content
Full Discussion: Retrieve message from file
Top Forums Shell Programming and Scripting Retrieve message from file Post 302105505 by mpang_ on Friday 2nd of February 2007 06:50:00 AM
Old 02-02-2007
Retrieve message from file

Hey all, I have this file which contains a lot of messages in format like

[2/2/07 13:23:00] This is my message!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Check This!
[2/2/07 13:23:10] This is my second message!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!
[2/2/07 13:24:48] This is my third message!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!

when I do "grep" on this file using "2/2/07 13:23", it returned

[2/2/07 13:23:00] This is my message!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[2/2/07 13:23:10] This is my second message!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

but in fact I want

[2/2/07 13:23:00] This is my message!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Check This!
[2/2/07 13:23:10] This is my second message!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!

since these messages span over several lines, could anyone tell me how to achieve what I need? Thank you so much!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

retrieve timestamp associated with a file

Hi All, I am involved in a Datawarehousing project where my data files(ASCII text) are loaded on a Unix directory. When I do a Ls -l in Unix prompt i get a file listing along with the timestamp when these files were created/put on the server. I need to retrieve the timestamp associated with each... (2 Replies)
Discussion started by: 2nilotpal
2 Replies

2. UNIX for Dummies Questions & Answers

How to retrieve a particular line from a file

Hi, I want to retrieve a particular line from a file and print its content to a file. Can you suggest how to do it in UNIX ?. Rgds vinayap (2 Replies)
Discussion started by: vinayap
2 Replies

3. UNIX for Dummies Questions & Answers

how to retrieve a particular character from a file?

hi, how to retrieve a particular character from a file? (1 Reply)
Discussion started by: singalla
1 Replies

4. Shell Programming and Scripting

retrieve value from a file

hi i have a cfg file,it contains lpdma520.dev.ipc.us.aexp.com=SUBMCORE.REQUEST.FT lpdma521.dev.ipc.us.aexp.com=SUBMCORE.REQUEST.FTREQ lpdma522.dev.ipc.us.aexp.com=SUBMITSECUREFILEFLOW i am retrieving the values using the function RetrieveCfgvalue() { CFG_VALUE=`grep "$2="... (1 Reply)
Discussion started by: satish@123
1 Replies

5. Shell Programming and Scripting

how to retrieve base name of the file

I have a file name stored in a variable. A=/bb/data/f233pdb How can I retrive the base name (f233pdb) and the path (/bb/data/) and assign them to two new variables, so the result will look like this B=f233pdb C=/bb/data/ Thansk a lot for any help -A (8 Replies)
Discussion started by: aoussenko
8 Replies

6. UNIX for Advanced & Expert Users

retrieve the file.

How will retrieve for a particular months file in UNIX say for example from January to February 2008. (1 Reply)
Discussion started by: rajesh08
1 Replies

7. Shell Programming and Scripting

retrieve string from file

hi, I have write a code to retrive data from each line of a file: sed -e '/^#/d' file.csv | awk '{ printf "TEST,%s:AUX,%s;\n", $0, "'A'"}' > pippo.txt where the input file.csv was like this: 1234 2345 2334 3344 and the output of my code is a file with: TEST,1234:AUX,A;... (7 Replies)
Discussion started by: fafo77
7 Replies

8. Shell Programming and Scripting

Retrieve old file in Solaris 10

Hello guys, I mistakely updated a file on Solaris 10. Any idea on how can I get the older version of file(File before being updated) back? Note: I do not have root access & have logged in as a user on the system. Thanks in advance, -Nithin. (3 Replies)
Discussion started by: bsnithin
3 Replies

9. UNIX for Dummies Questions & Answers

Hot to retrieve *.sql file names which we refer in .sh file.

Hi Guys, How to retrieve/get *.sql file names which we refer in all *.sh files. Can any one help me on this. Thanks, Kolipaka (3 Replies)
Discussion started by: lakshmanrk811
3 Replies

10. UNIX for Beginners Questions & Answers

Grep: Retrieve two strings from one file to find them anyone on line in another file

I am having trouble matching *two* strings from one file anywhere in a line of a second file, and could use some help getting this figured out. My preference would be to use grep for this because I would like to take advantage of its -A option. The latter is due to the fact that I would like both... (2 Replies)
Discussion started by: jvoot
2 Replies
msgid(1M)                                                 System Administration Commands                                                 msgid(1M)

NAME
msgid - generate message IDs SYNOPSIS
/usr/sbin/msgid DESCRIPTION
The msgid utility generates message IDs. A message ID is a numeric identifier that, with a high probability, uniquely identifies a message. The probability of two distinct messages having the same ID is about one in a million. Specifically, the message ID is a hash signature on the message's unexpanded format string, generated by STRLOG_MAKE_MSGID() as defined in <sys/strlog.h>. syslogd(1M) is a simple filter that takes strings as input and produces those same strings, preceded by their message IDs, as output. Every message logged by syslogd(1M) includes the message ID. The message ID is intended to serve as a small, language-independent identifier. EXAMPLES
Example 1: Using the msgid command to generate a message ID The following example uses the msgid command to generate a message ID for the echo command. example# echo hello | msgid 205790 hello Example 2: Using the msgid command to generate a message catalog The following example uses the msgid command to enumerate all of the messages in the binary ufs, to generate a message catalog. example# strings /kernel/fs/ufs | msgid 137713 free: freeing free frag, dev:0x%lx, blk:%ld, cg:%d, ino:%lu, fs:%s 567420 ialloccg: block not in mapfs = %s 845546 alloc: %s: file system full ... ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
syslogd(1M), attributes(5), log(7d) SunOS 5.10 9 Oct 1998 msgid(1M)
All times are GMT -4. The time now is 03:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy