Sponsored Content
Top Forums Shell Programming and Scripting Can anyone guide me with the BASH scripting Post 302410603 by shyork2001 on Tuesday 6th of April 2010 10:40:53 AM
Old 04-06-2010
Bug Can anyone guide me with the BASH scripting

Hi,

I am new to BASH script. I am working on the script to parsing the log message . the followings are my task:

1. Read the multiple log files, such as N1-2009-10-01, N2-2009-10-2, N3-2010-01-02....
2. Parse the specific message, such as "aaaa"
3. If found the "aaaa" message in the log file and export to excel file

PS. i use zgrep:
Code:
zgrep -a --text "aaaa" * > /home/TTS/myfile

and inside file looks like:

Code:
N3.2009-11-26-03-05-02.console.log.tar.gz:2009-11-25 20:12:57,429 - aaaa
N4.2009-11-29-00-25-03.console.log.tar.gz:2009-11-28 10:42:18,209 - aaaa
N6.2009-12-01-10-05-02.console.log.tar.gz:2009-12-01 10:00:24,902 - aaaa

How can i use the script export these information into excel file into three columns, like
Code:
N3  2009-11-25 20:12:57 aaaa
N4  2009-11-28 10:42:18 aaaa
N6  2009-12-01 10:00:24 aaaa


Thanks

Last edited by Franklin52; 04-06-2010 at 02:12 PM.. Reason: Please use code tags.
 

5 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

comprehensive guide for shell scripting programming

Dear all Any recommendation for this, web-site or publisher? (3 Replies)
Discussion started by: trynew
3 Replies

2. UNIX for Dummies Questions & Answers

Should I do a bash scripting course?!

Hello, I'm confused (oh, yes). I'm running Linux at work. When I type 'echo $SHELL' I am told that I'm running tcsh. In /bin I note that both tcsh and bash are listed. Question 1: Can I swap to run bash rather than tcsh and, if so, how will this affect my system? Is there any advantage to... (6 Replies)
Discussion started by: macpete
6 Replies

3. Shell Programming and Scripting

bash scripting help

hi all i'm trying to get a script working upon connection with pppd According to docu this happens ina clean environment with a couple of variables set, namely $1,$2,... To be able to execute the statements i included a path statement but i think i'm running into trouble with the variables -... (6 Replies)
Discussion started by: jimjones
6 Replies

4. Shell Programming and Scripting

bash scripting

Hello everyone!!!! I am new to this forum ...I have a problem. And I thought that you are expert :) so you can help me with that... I have a text file with maaany lines. Every line begins with something like that: <http aksjfskcuhrf kushkfsnus> <http sxnfrksehfsd gsdg r> I don't know if every... (16 Replies)
Discussion started by: mary_elen
16 Replies

5. Shell Programming and Scripting

bash scripting

same script: 1- i am using grep to find a string called: tinker panic 0 in a file /etc/ntp.conf if the string is not there, i want to add the strings in /etc/ntp.conf file in the first line of the file. if not do nothing or exit. 2- also i want to add # in front of the following lines in... (0 Replies)
Discussion started by: lamoul
0 Replies
BF_TAR(1)						    Bogofilter Reference Manual 						 BF_TAR(1)

NAME
bf_tar - shell script to write a tar file of a bogofilter directory to stdout SYNOPSIS
bf_tar [-r] [-R] bogofilter_directory DESCRIPTION
bf_tar bundles a bogofilter working directory in tar format and copies it to standard output (your console, or where you redirect it, see EXAMPLES below). OPTIONS
The -r option causes bf_tar to remove inactive log files after the archive has been written successfully. The default is to leave log files. The -R option causes bf_tar to remove inactive log files before the archive is written. This may reduce chances that the resulting archive is recoverable should it become damaged. The archive may be smaller though. The default is to leave log files. EXIT STATUS
The script exits with status code 0 if everything went well, and nonzero if it encountered trouble. EXAMPLES
o bf_tar ~/.bogofilter > outfile.tar Writes a standard .tar file containing the essential files from ~/.bogofilter to outfile.tar. o bf_tar ~/.bogofilter | gzip -9 -c > outfile.tar.gz Writes a gzipped .tar.gz file containing the essential files from ~/.bogofilter to outfile.tar.gz. o bf_tar `pwd`/mydirectory > outfile.tar Prepend $(pwd)/ or `pwd`/ if you want to specify an absolute path instead of a relative path. NOTES
This script is meant for use with Berkeley DB based bogofilter versions. This script requires a SUSv2 compliant pax utility. This script expects a SUSv2 compliant shell. Solaris systems should have the SUNWxcu4 package installed (when bogofilter is configured) so that /usr/xpg4/bin/sh can be used. AUTHORS
Matthias Andree Bogofilter 10/22/2012 BF_TAR(1)
All times are GMT -4. The time now is 07:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy