Sponsored Content
Top Forums Shell Programming and Scripting Script to extract line from logfile Post 302358670 by garryt21@rediff on Sunday 4th of October 2009 02:04:25 AM
Old 10-04-2009
Hi JP,

I made the changes as you suggested and executed the script.

$ awk -f log.awk gtest/svtaree/*
awk: log.awk:32: (FILENAME=gtest/svtaree/access_07.09.09.log FNR=111) fatal: can't redirect to `gtest/svtaree/access_07.09.09/test.txt' (No such file or directory)

$ awk -f log.awk gtest/*/*
awk: log.awk:32: (FILENAME=gtest/svtaree/access_07.09.09.log FNR=111) fatal: can't redirect to `gtest/svtaree/access_07.09.09/test.txt' (No such file or directory)

It did create a file access_07.09.09.log.strip.
The script this time copied the other entries and copied to access_07.09.09.log.strip, leaving the GuestUser entries in the original file.
And it looks like it took only the first logfile in the path.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Script to Extract the line from File with specified offset

Hi All, I need to extract only XML details from large log file which may contain other unwanted junk details. For example, our xml will be start as <OUTBOUND_MESSAGE .....> and ends with </OUTBOUND_MESSAGE>. I want to extract only lines between these start and end tag (Including these tags)... (5 Replies)
Discussion started by: thinakarmani
5 Replies

2. Shell Programming and Scripting

Need to extract specific pattern from logfile

Log File: Attempting to contact (DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=hostname1.com)(PORT=1521)))(CONNECT_DATA=(SID=database1)(SRVR=DEDICATED))) Attempting to contact... (2 Replies)
Discussion started by: techychap
2 Replies

3. Shell Programming and Scripting

Logfile - extracting certain lines to concatenate into 1 line

I've got a log file from automatic diagnostic runs. The log file is appended to each time an automatic log is run. I'd like to just pull certain lines from each run in the log file, and concatenate them into 1 comma delimited line (for export into excel or an html table). Each diagnostic run... (3 Replies)
Discussion started by: BecTech
3 Replies

4. Shell Programming and Scripting

get the fifth line of a text file into a shell script and trim the line to extract a WORD

FOLKS , i have a text file that is generated automatically of an another korn shell script, i want to bring in the fifth line of the text file in to my korn shell script and look for a particular word in the line . Can you all share some thoughts on this one. thanks... Venu (3 Replies)
Discussion started by: venu
3 Replies

5. Shell Programming and Scripting

Search for a pattern,extract value(s) from next line, extract lines having those extracted value(s)

I have hundreds of files to process. In each file I need to look for a pattern then extract value(s) from next line and then search for value(s) selected from point (2) in the same file at a specific position. HEADER ELECTRON TRANSPORT 18-MAR-98 1A7V TITLE CYTOCHROME... (7 Replies)
Discussion started by: AshwaniSharma09
7 Replies

6. Shell Programming and Scripting

HELP: Shell Script to read a Log file line by line and extract Info based on KEYWORDS matching

I have a LOG file which looks like this Import started at: Mon Jul 23 02:13:01 EDT 2012 Initialization completed in 2.146 seconds. -------------------------------------------------------------------------------- -- Import summary for Import item: PolicyInformation... (8 Replies)
Discussion started by: biztank
8 Replies

7. Shell Programming and Scripting

Extract three substrings from a logfile

I have a log file like below. 66.249.73.11 - - "UCiZ7QocVqYAABgwfP8AAHAA" "US" "Mediapartners-Google" "-" www.mahashwetha.com.sg "GET... (2 Replies)
Discussion started by: Tuxidow
2 Replies

8. Shell Programming and Scripting

Unique line from logfile

Hi Team, Pls help me in fixing this problem. I have file called ORA_FILE.log Please find the log in that below: ************************ ORA-04061: existing state of package body "MST.ONE_PACKAGE" has been invalidated ORA-04065: not executed, altered or dropped package body... (2 Replies)
Discussion started by: indira_s
2 Replies

9. Shell Programming and Scripting

Extract the last 10 minutes from logfile

Any better way to extract the last 10 minutes from logfile? Dec 18 09:41:18 aaa Dec 18 09:46:29 aa Dec 18 09:48:39 vvv Dec 18 09:48:54 bbb Dec 18 09:54:47 bbb Dec 18 09:55:33 fcf Dec 18 09:55:38 ssdf Dec 18 09:57:58 sdsds Dec 18 09:58:10 sdsd Dec 18 10:00:50 sdsd Dec 18... (5 Replies)
Discussion started by: timmywong
5 Replies

10. Shell Programming and Scripting

Logfile monitoring with logfile replacement

Bonjour, I've wrote a script to monitor a logfile in realtime. It is working almost perfeclty except for two things. The script use the following technique : tail -fn0 $logfile | \ while read line ; do ... some stuff done First one, I'd like a way to end the monitoring script if a... (3 Replies)
Discussion started by: Warluck
3 Replies
LOGSAVE(8)						      System Manager's Manual							LOGSAVE(8)

NAME
logsave - save the output of a command in a logfile SYNOPSIS
logsave [ -asv ] logfile cmd_prog [ ... ] DESCRIPTION
The logsave program will execute cmd_prog with the specified argument(s), and save a copy of its output to logfile. If the containing directory for logfile does not exist, logsave will accumulate the output in memory until it can be written out. A copy of the output will also be written to standard output. If cmd_prog is a single hyphen ('-'), then instead of executing a program, logsave will take its input from standard input and save it in logfile logsave is useful for saving the output of initial boot scripts until the /var partition is mounted, so the output can be written to /var/log. OPTIONS
-a This option will cause the output to be appended to logfile, instead of replacing its current contents. -s This option will cause logsave to skip writing to the log file text which is bracketed with a control-A (ASCII 001 or Start of Header) and control-B (ASCII 002 or Start of Text). This allows progress bar information to be visible to the user on the console, while not being written to the log file. -v This option will make logsave to be more verbose in its output to the user. AUTHOR
Theodore Ts'o (tytso@mit.edu) SEE ALSO
fsck(8) E2fsprogs version 1.41.11 March 2010 LOGSAVE(8)
All times are GMT -4. The time now is 06:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy