Sponsored Content
Top Forums Shell Programming and Scripting Extarcting data from a file that matches two different patterns Post 302219847 by joeyg on Wednesday 30th of July 2008 08:02:05 AM
Old 07-30-2008
Hammer & Screwdriver Perhaps a start to a solution...

Since you have so much of the sample in a "test" format, it was difficult to understand what you are trying to retrieve for output. However, take a look at the following commands and resulting output:

Code:
> sed <sample_log "s/Message/~Message/g" | tr "\n" " " | tr "~" "\n" | grep "XXXX"
Message Discriptor zSACZXCZCXb,nATimestampABpDSaErrordsbASD dfvdfgvADSasdASXXXXDasdASDasdASDasdASDAds ============ 
Message Discriptor casTEST1DCZXCZXCZTimestampXCacsErrorJ,ADasdb,nADSadsbASD adfsadsasdZXZcdawsdqadaxax ADSasdASDasxvxcXXXXvdASDasdASDasdASDAds ============ 
Message Discriptor casDCacsxTEST1cvTimestampzxcErrorvJ,ADasdb,nADSadsbASD sazdfcafdafdsadsadsads ADSasdASDaXXXXsdASDvxcvxvcasdASDasdASDAds ============ 
Message Discriptor casDCacsxTEST1cvzxTimestampcvJ,ADErrorasdb,nADSadsbASD ADSasdASDaXXXXsdASDvxcvxvcasdASDasdASDAds casDCacsxTEST1cvzxcvJ,ADasdb,nADSadsbASD sazdfcafdafdsadsadsads ============

From this, I think you can append additional cut/grep commands to further refine the data.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extarcting particular fields from a file

Hi, I have a file called status.txt Now that file has got fields and values like this: Owner Workitem progress targetdate Peter Development 50% 26/04/2006 Now I have one more file called status1.txt that has got only the field names: Owner ... (2 Replies)
Discussion started by: sendhilmani123
2 Replies

2. Shell Programming and Scripting

Searching patterns in 1 file and deleting all lines with those patterns in 2nd file

Hi Gurus, I have a file say for ex. file1 which has 3500 lines in it which are different account numbers and another file (file2) which has 230000 lines in it. I want to read all the lines in file1 and delete all those lines from file2 which has that same pattern as in file1. I am not quite... (4 Replies)
Discussion started by: toms
4 Replies

3. Shell Programming and Scripting

Capturing data between patterns

Hii, Friends, I want your help in one of my problem. My problem is as follows. I have a flat file as follows (Just a sample) MHT011 01(DOT)8750707asdfas8609 03(DOT)ASD3453ASD 09(DOT)876JHT87 11(DOT)sfd324ert TTT077 01(MOB)876786klj897 06(MOB)876JHT87 07(MOB)sfd324ert... (4 Replies)
Discussion started by: anushree.a
4 Replies

4. UNIX for Dummies Questions & Answers

Pipe binary file matches grep results to file

I am using grep to match a pattern, but the output is strange. $ grep -r -o "pattern" * Gives me: Binary file foo1 matches Binary file foo2 matches Binary file foo3 matches To find the lines before/after, I then have to use the following on each file: $ strings foo1 | grep -A1 -B1... (0 Replies)
Discussion started by: chipperuga
0 Replies

5. Shell Programming and Scripting

Replace column that matches specific pattern, with column data from another file

Can anyone please help with this? I have 2 files as given below. If 2nd column of file1 has pattern foo1@a, find the matching 1st column in file2 & replace 2nd column of file1 with file2's value. file1 abc_1 foo1@a .... abc_1 soo2@a ... def_2 soo2@a .... def_2 foo1@a ........ (7 Replies)
Discussion started by: prashali
7 Replies

6. Shell Programming and Scripting

Find matches and write the data before it

Hi all I am here for help once again I have two files One file is like this with one columns F2 B2 CAD KGM HTC CSP Second file is like this in 5 columns where firs column contain sometime entries of first file with space and other entries (12 Replies)
Discussion started by: Priyanka Chopra
12 Replies

7. Shell Programming and Scripting

How to print line if two lines above it matches patterns.?

Hi, I could only find examples to print line before/after a match, but I'd need to print line after two separate lines matching. E.g.: From the below log entry, I would need to print out the 1234. This is from a huge log file, that has a lot of entries with "CLIENT" and "No" entries (+ other... (3 Replies)
Discussion started by: Juha
3 Replies

8. Shell Programming and Scripting

Egrep patterns in a file and limit number of matches to print for each pattern match

Hi I need to egrep patterns in a file and limit number of matches to print for each matched pattern. -m10 option is not working out in my sun solaris 5.10 Please guide me the options to achieve. if i do head -10 , i wont be getting all pattern match results as output since for a... (10 Replies)
Discussion started by: ananan
10 Replies

9. Shell Programming and Scripting

awk to print match or non-match and select fields/patterns for non-matches

In the awk below I am trying to output those lines that Match between file1 and file2, those Missing in file1, and those missing in file2. Using each $1,$2,$4,$5 value as a key to match on, that is if those 4 fields are found in both files the match, but if those 4 fields are not found then missing... (0 Replies)
Discussion started by: cmccabe
0 Replies

10. Shell Programming and Scripting

Bash - Find files excluding file patterns and subfolder patterns

Hello. For a given folder, I want to select any files find $PATH1 -f \( -name "*" but omit any files like pattern name ! -iname "*.jpg" ! -iname "*.xsession*" ..... \) and also omit any subfolder like pattern name -type d \( -name "/etc/gconf/gconf.*" -o -name "*cache*" -o -name "*Cache*" -o... (2 Replies)
Discussion started by: jcdole
2 Replies
ESDCTL(1)						     Enlightened Sound Daemon							 ESDCTL(1)

NAME
esdctl - The Enlightened Sound Daemon DESCRIPTION
Command-line control program for EsounD USAGE
esdctl [options] [command] options: "-s", --server=host:port contact esd server on host at port commands: lock foreign clients may not use the server unlock foreign clients may use the server standby, off suspend sound output for other programs resume, on resume sound output cache sample cache a sample in the server getid name retrieve a sample id from its name free name uncache a sample in the server play name play a cached sample once loop name make a cached sample loop stop name stop the looping sample at end serverinfo get server info from server allinfo get player and sample info from server panstream id left right set panning for a stream pansample id left right set default panning for a sample - left/right pan values scaled to 256. standbymode see if server's on standby, etc. SEE ALSO
esd(1), esdcat(1), esddsp(1), esdloop(1), esdplay(1), esdsample(1), esd-config(1), esdfilt(1), esdmon(1), esdrec(1) 3rd Berkeley Distribution EsounD 0.2.28 ESDCTL(1)
All times are GMT -4. The time now is 06:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy