05-11-2009
cat file and parse output
Hello,
I'm new to shell scripting and did a search on the forum to what I want to do but couldn't find anything.
I have about 9 routers that outputs to 1 syslog file daily named cisco.year.mo.date.log ex: cisco.2009.05.11.log
My goal is to make a parsing script that cats today's syslog file, grep the router's hostname in the file, and output it to a text file with today's date and hostname, and continue to append to that file until the next day. I intend to make this script run every 30 minutes which is something I know how to do via the crontab. If a router doesn't generate a syslog file then skip that hostname. This is so it will be easier for me to see if that router generated a syslog file and what happened to it. Any help or guidance will be greatly appreciated
Thanks in advance
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi, everyone
The input file pattern is like below:
Begin Object1
txt1
end
;
Begin Object2
txt2
end
;
... (14 Replies)
Discussion started by: sophiadun
14 Replies
2. UNIX for Advanced & Expert Users
I have one file say CM.txt which contains values like below.Its just a flat file
1000,A,X
1001,B,Y
1002,B,Z
...
..
total around 4 million lines of entries will be in that file.
Now i need to write another file CM1.txt which should have
1000,1
1001,2
1002,3
....
...
..
Here i... (6 Replies)
Discussion started by: sivasu.india
6 Replies
3. Shell Programming and Scripting
suppose if u have a file like that
Hen ABCCSGSGSGJJJJK 15
Cock ABCCSGGGSGIJJJL 15
* * * * * * : * * * . * * * :
Hen CFCDFCSDFCDERTF 30
Cock CHCDFCSDHCDEGFI 30
* . * * * * * * * : * * :* : : .
The output shud be
where there is : and .
It shud... (4 Replies)
Discussion started by: cdfd123
4 Replies
4. Shell Programming and Scripting
I have a file, not really a csv, but containing delineated data just the same. Lets call that file "raw_data.txt". It contains data in the format of company name:fein number like this:
first company name:123456789
second company name:987654321
what i need to do is read this file, apply... (11 Replies)
Discussion started by: FreddyG
11 Replies
5. UNIX for Dummies Questions & Answers
I use the cat command to concatenate text files, but one of the rows I was expecting doesn't display in the output file. Is there a verbose mode\logging mechanism for the cat command to help me investigate where the lines I was expecting are going??
cat 7760-001_1_*_06_*.txt | grep -v... (1 Reply)
Discussion started by: Xin Xin
1 Replies
6. Shell Programming and Scripting
Hi All,
I have an input file containing data as below:
Input.DAT
XXXXXXX|YYYYYYY|ZZZZZZZZZZ|12334446456|B|YY|111111111|111111111|111111111|111111111|15|3|NNNNNN|Y|3|AAA|111111111... (11 Replies)
Discussion started by: sagar.cumar
11 Replies
7. Shell Programming and Scripting
I have a file
# cat /root/llll
11
22
33
44
When I cat this file content to a variable inside a shell script and echo that shell script, it does not show up as separate lines. I need echo output similar to cat.
cat /root/shell_script.sh
#!/bin/bash
var=`cat /root/llll`
echo $var (2 Replies)
Discussion started by: anil510
2 Replies
8. UNIX for Dummies Questions & Answers
Team,
we use below command to store the contents in a logfile.
cat a.txt > a.log
a.txt content is
123
345
Is there any options available to store the command used also?
for eg a.log may show as
cat a.txt
123
345 (5 Replies)
Discussion started by: sid2013
5 Replies
9. Shell Programming and Scripting
Hello,
I'm on a remote computer by SSH. How can I get the output of "cat file" into a file on the local computer?
I cannot use scp, because it's blocked.
something like:
ssh root@remote_maschine "cat /file" > /locale_machine/file
:rolleyes: (2 Replies)
Discussion started by: borsti007
2 Replies
10. Shell Programming and Scripting
My source file looks like this:
Cust-Number = "101"
Cust-Name="Joe"
Cust-Town="London"
Cust-hobby="tennis"
Cust-purchase="200"
Cust-Number = "102"
Cust-Name="Mary"
Cust-Town="Newyork"
Cust-hobby="reading"
Cust-purchase="125"
Now I want to parse this file (leaving out hobby) and... (10 Replies)
Discussion started by: Balav
10 Replies
LEARN ABOUT OSF1
syslog.auth
syslog.auth(4) Kernel Interfaces Manual syslog.auth(4)
NAME
syslog.auth - authorization file for accepting remote syslog messages
SYNOPSIS
# format: Each fully qualified host name on a separate line hostname.domain_name
DESCRIPTION
The /etc/syslog.auth file specifies which remote hosts are allowed to forward syslog messages to the local host. For the sake of security,
only messages coming from remote hosts listed in the local /etc/syslog.auth file will be logged by the syslogd daemon.
If the /etc/syslog.auth file does not exist, then messages coming from any host will be accepted.
Each remote host name should appear in a separate line in /etc/syslog.auth. A line started with the # character is considered as a comment
and is thus ignored.
A host name must be a complete domain name such as trout.zk3.dec.com. If a domain host name is given, it must either appear in the local
/etc/hosts file or be able to be resolved by the local name server (BIND).
Note that a host name can have at most as many characters as defined by the MAXHOSTNAMELEN constant in <sys/param.h>, although each line
in the /etc/syslog.auth file can have up to 512 characters.
The /etc/syslog.auth file must be owned by root and has a permission of 0600.
To invoke a new version of the /etc/syslog.auth file, run the following command (as the super user) to initialize the syslogd daemon: kill
-HUP `cat /var/run/syslog.pid`
EXAMPLES
The following example provides a typical authorization file: # format: Each fully qualified host name on a separate line
c3poid.rvo.dec.com r2d2id.ckt.dec.com
FILES
Location of the authorization file.
RELATED INFORMATION
Commands: syslogd(8), syslog(1)
System Administration delim off
syslog.auth(4)