Sponsored Content
Top Forums Shell Programming and Scripting Print text it contains a certain term... Post 302555989 by Aswex on Friday 16th of September 2011 09:13:40 AM
Old 09-16-2011
Print text it contains a certain term...

Hello,

I need to extract execution error on a log file. I am on Linux, but I can only use bash or ksh.

As a sample of what I'm needing, here is some data;

Code:
***** L1 FILE VAX_ASP1_SATx_E_IM20101017035246 - CPU TIME 2011-04-29T09:57:57 *****
GMT_PRODUCT_CREATION_TIME = 2011-04-29T09:57:57
Execution OK
***** L1 FILE VAX_ASP1_SATx_E_IM20101017162551 - CPU TIME 2011-04-29T09:59:51 *****
ERROR : Cannot open /DATA/ASPERA4//DATA/AU/PAHLR.asc PAHLR file
GMT_PRODUCT_CREATION_TIME = 2011-04-29T09:59:51
Execution OK
***** L1 FILE VAX_ASP1_SATx_E_IM20101018034316 - CPU TIME 2011-04-29T10:00:37 *****
GMT_PRODUCT_CREATION_TIME = 2011-04-29T10:00:37
Execution OK
***** L1 FILE VAX_ASP1_HKxx_E_RT20110531220100 - CPU TIME 2011-09-14T19:18:00 *****
GMT_PRODUCT_CREATION_TIME = 2011-09-14T19:18:00
Execution OK

The general idea is that I want to "search" a bit of text like this for certain terms, such as "Content-Length:" but also to be able to filter by "date" as I do not want to see all error that contain the log file and receive the following as the result ..

Code:
***** L1 FILE VAX_ASP1_SATx_E_IM20101017162551 - CPU TIME 2011-04-29T09:59:51 *****
ERROR : Cannot open /DATA/ASPERA4//DATA/AU/PAHLR.asc PAHLR file
GMT_PRODUCT_CREATION_TIME = 2011-04-29T09:59:51
Execution OK

Thanks for your help
 

10 More Discussions You Might Find Interesting

1. Programming

Create a Term & Run chars on this Term

hi floks ! i'd like to know how can i transmete a character or a string from my source code to a term and make it interpret or un by the shell wich is running in my term. I'd like to create a Term from my code (and get its file descriptor) and then transmete each char typed on the keyboard to... (1 Reply)
Discussion started by: the_tical
1 Replies

2. Shell Programming and Scripting

Search term and output term in desired field

Hi All, I have an input_file below and i would like to use Perl to search for the term "aaa" and output the 3rd term in the same row as "aaa".For Example, i want to search for the term "ddd" and would want the code to ouput the 3rd term in the same row which is "fff". Can somebody help ? ... (28 Replies)
Discussion started by: Raynon
28 Replies

3. Shell Programming and Scripting

Search text from a file and print text and one previous line too

Hi, Please let me know how to find text and print text and its previous line. Please don't get irritated few days back I asked text and next line. I am using HP-UX 11.11 Thanks for your help. (6 Replies)
Discussion started by: kamranjalal
6 Replies

4. Shell Programming and Scripting

process text between pattern and print other text

Hi All, The file has the following. =========start of file=== This is a file containing employee info START name john id 123 date 12/1/09 END START name sam id 4234 date 12/1/08 resigned END (9 Replies)
Discussion started by: vlinet
9 Replies

5. AIX

Print text between two delimiters

Hi, Can somebody help me with the below situation, Input File, ======== 2007_08_07_IA-0100-014_(MONTHLY).PDF 2007_08_07_IA-0100-031_(QUARTERLY)(RERUN).PDF 2008-02-28_KR-1022-003_(MONTH)(RERUN)(REC1).CSV Required output, ============ MONTHLY QUARTERLY MONTH ... (15 Replies)
Discussion started by: sravicha
15 Replies

6. Shell Programming and Scripting

Print text between delimiters IF it contains a certain term...

So I'm racking my brain on appropriate ways to solve a problem that once fixed, will solve every problem in my life. Its very easy (for you guys and gals) I'm sure, but I can't seem to wrap my mind around the right approach. I really want to use bash to do this, but I can't grasp how I'm going to... (14 Replies)
Discussion started by: eh3civic
14 Replies

7. Shell Programming and Scripting

awk based script to print the "mode(statistics term)" for each column in a data file

Hi All, Thanks all for the continued support so far. Today, I need to find the most occurring string/number(also called mode in statistics terminology) for each column in a data file (.csv type). For one column of data(1.txt) like below Sample 1 2 2 3 4 1 1 1 2 I can find the mode... (6 Replies)
Discussion started by: ks_reddy
6 Replies

8. UNIX for Dummies Questions & Answers

How to create a print filter that print text & image?

Currently, I have a print filter that takes a text file, that convert it into PCL which then gets to a HP printer. This works. Now I need to embedded a image file within the text file. I'm able to convert the image file into PCL and I can cat both files together to into a single document... (1 Reply)
Discussion started by: chedlee88-1
1 Replies

9. Shell Programming and Scripting

Match text and print/pipe only that text

I'm trying to pull an image source url from a html source file. I'm new with regex. I'm in BaSH. I've tried grep -E 'http.*jpg' file which highlights the text, but gives me 2 problems: 1) Results aren't stand alone and can't be piped to another command. (I believe it includes everything in... (5 Replies)
Discussion started by: amx401
5 Replies

10. Shell Programming and Scripting

Match text to lines in a file, iterate backwards until text or text substring matches, print to file

hi all, trying this using shell/bash with sed/awk/grep I have two files, one containing one column, the other containing multiple columns (comma delimited). file1.txt abc12345 def12345 ghi54321 ... file2.txt abc1,text1,texta abc,text2,textb def123,text3,textc gh,text4,textd... (6 Replies)
Discussion started by: shogun1970
6 Replies
suspend(1)                                                         User Commands                                                        suspend(1)

NAME
suspend - shell built-in function to halt the current shell SYNOPSIS
sh suspend csh suspend ksh suspend DESCRIPTION
sh Stops the execution of the current shell (but not if it is the login shell). csh Stop the shell in its tracks, much as if it had been sent a stop signal with ^Z. This is most often used to stop shells started by su. ksh Stops the execution of the current shell (but not if it is the login shell). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), kill(1), ksh(1), sh(1), su(1M), attributes(5) SunOS 5.10 15 Apr 1994 suspend(1)
All times are GMT -4. The time now is 09:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy