But it all sounds so good in my head when I am typing it out! lol
I am truly sorry.
I am getting information from a cisco switch or router and the format of the output is different depending on the type of device connected. In some cases a match will be made and the field will be returned in other cases it doesnt exist and I would like NA to be printed in its place. This will keep all fields in the output file uniform which is key for the excel import that needs to occur. What is happening is some of the devices wont return a match for the " /VLAN:/" field. Well when this happens, it shifts everything in the output one column to the left.
Does that help to clarify? Im truly not trying to be cryptic but apparently not intelligent enough to properly communicate my problem. Thanks for your help, I do appreciate it
I don't have a Cisco switch or router handy to attempt to see what log output they produce.
I assume that the sample input you showed us in post #4 is not the contents of a switch or router log, but something that you have created by processing the log files to try to get data in the format that you want.
Please show us small samples of the data that would be found in your switch log file and the date that would be found in your router log file and explain the format of both of those.
Then explain the format of the output you hope to produce.
Then show us the output that you hope to produce by processing those two sample log files.
Sorry been away for a week. Ok, heres what Im doing:
There are several command outputs from routers and switches that have different information that is useful when looking to redesign. These are not log files. The format is all over the board between files. Ive been parsing through these files individually, extracting the data that I find valuable, formatting it for CSV.
I start with one file, parse through, create a file, then use one of the fields like a key field (VLAN or interface). When I make a match (depending on which field I am keying on, I add the correlating information to the end of the file in CSV format that I can import into a spreadsheet for quick reference).
As Ive been going through the files, when I match on one key word or another, if they keyword isnt present in the show file then it is throwing off the rest of the "complete file"
Im not trying to be cryptic or dodgy with my answers, I find that at times I am not great at explaining myself.
Here is an output example pulled from a spreadsheet: (first line had matches in all fields, second was missing a match which through all results to the left / incorrect fields in the output)
i want to search a log for a string. when that string is found, i want to grab the a set number of lines that came before the string, and a set number of lines that come after the string.
so if i search for the word "Error" in the /var/log/messages file, how can I output the 20 lines that came... (4 Replies)
hello,
I have problem with writing/adjusting a shell script.
I searched forum and unfortunately couldn't write scipt based on the information I found.
I never wtire such so it's hard for me and I do need to modify one script immediately.
case looks like:
1. 'file' that needs to be modified... (3 Replies)
Right now, my code is:
s/Secondary Ins./Secondary Ins.\
1/g
It's adding a 1 as soon as it finds Secondary Ins.
Primary Ins.: MEDICARE B DMERC Secondary Ins.
1: CONTINENTAL LIFE INS
What I really want to achieve is having a 1 added on the next line that contain "Secondary Ins." It... (4 Replies)
Hi,
I have two variables x and y.
i need to find a particular string in a file, a workflow name and then insert the values of x and y into the next lines of the workflow name.
basically it is like as below
wf_xxxxxx
$$a=
$$b=
$$c= figo
$$d=bentley
i need to grep the 'wf_xxxx' and then... (6 Replies)
Hello Everyone,
I just started scripting this week. I have no background in programming or scripting.
I'm working on a script to grep for a variable in a log file
Heres what the log file looks like. The x's are all random clutter
xxxxxxxxxxxxxxxxxxxxx START: xxxxxxxxxxxx... (7 Replies)
Hi all,
I have a question..
Here is my requirement..I have 500 files in a path say /a/b/c
I have some numbers in a file which are comma seperated...and I wanted to check if the numbers are present in the FileName in the path /a/b/c..if the number is there in the file that is fine..but if... (1 Reply)
finding a string with another string is found
EX:
abs c/-
i want to find /-, then copy abs. i know it's easy use awk, but my problem is the substr syntax.
substr($2,2,2) will give me /-
but the conflict is /- is not always the second characted of the second string. (11 Replies)
CPAN.pm: Going to build G/GA/GAAS/Unicode-String-2.09.tar.gz
Checking if your kit is complete...
Looks good
Writing Makefile for Unicode::String
cp String.pm blib/lib/Unicode/String.pm
cp lib/Unicode/CharName.pm blib/lib/Unicode/CharName.pm
/usr/bin/perl /usr/perl5/5.8.4/lib/ExtUtils/xsubpp... (5 Replies)
In my script I read a input file and search all the files in a directory and it's sub-directories for that string using:
find . -type f -print | xargs grep $var1
This just displays all the lines the string was found on. Too much data.
What I need is to store in a file one time those... (17 Replies)
Is there a way for grep to output only the found string and not the whole line?
I have a ksh script which reads in a file and loops through every line looking up on a grep -f list. For it to only display only the string found i pass this to awk as a variable and loop through the list file using... (5 Replies)