Hi,
I spend few hours already searching this forum, but cannot find the solution matching exactly my case.
I have multiple log files, I need to filter them so I get info about certain event.
So we have files:
LOGA.txt
LOGB.txt
LOGC.txt
LOGD.txt
LOGE.txt
1. I need to grep lines in LOGA.txt matching pattern (RefId)
2. Now I want to search LOGB.TXT for value Tag= from LOGA.txt
I guess I need to get Tag="number" set as variable ($Tag), that's the problem I don't know how to do it
And I can do the same as in step 1
and then search for another patterns in other log files with similar procedure.
I got step 1 someway.
Any help would be appreciated.
Output the first grep to a file. Then from that file, get the TAG information into the shell, like this:
The sed command finds a line with Tag= in it, and then removed everything up to and including the = sign. The rest it prints out, which should be just your number. Now you can go grepping for that likewise.
and so on.
Thank you otheus,
it was very helpful, now I know how to find and set variable,
but now I am bit struggling to join commands together.
Tag is set correctly, echo displays number for this tag but grep -- "$tag" *LOGB* shows nothing, if I put number instead of variable it works fine.
What do I need to do to make it working?
Insert "set -x" above the first line starting with "echo". The re-run it and you still what command bash actually executed. This is the way to debug scripts in the shell.
these files are from Windows server, so it could make sense?
I don't know why $ sign is there, command is as I wrote grep -- "$tag" *LOGB*, interesting thing is when I try
grep -- "$tag" *
it shows some results from LOGA.txt but ignores LOGB.txt file
I have a source csv file consists of first field as variable name, and the rest are site-specific information (converted from excel file, where site -specific values in columns). I am trying to create a file for every site using a template and replace the multiple variables with values from the... (3 Replies)
I have several problems with my problems: I hope you can help me.
1) the If else statement I am getting an error message. My syntax must be incorrect because the entire statement is throwing an error.
For example in filew.log if these items don't exist Memsize, SASFoundation and also if... (0 Replies)
Hello,
I would like to ask for help with csh script.
An example of an input in .txt file is below, the number of lines varies from file to file and I have 2 or 3 columns with values. I would like to read all the values (probably one by one) and set them to independent unique variables that... (7 Replies)
Hi All,
i have a requirement where i have to run a script with at least 25 arguements and position of arguements can also change. the unapropriate way is like below. can we achieve this in more good and precise way??
#!/bin/ksh
##script is sample.ksh
age=$1
gender=$2
class=$3
.
.
.... (3 Replies)
Experts Good day,
I want to filter multiple lines of same error of same day , to only 1 error of each day, the first line from the log.
Here is the file:
May 26 11:29:19 cmihpx02 vmunix: NFS write failed for server cmiauxe1: error 5 (RPC: Timed out)
May 26 11:29:19 cmihpx02 vmunix: NFS... (4 Replies)
I am trying to rename multiple files from lower case to upper case, but then I need to change the word SHIP to Ship and CSV to csv. This is a sample of the input file name input_file_ship_1234_20110106.csv I need this to look like this INPUT_FILE_Ship_1234_20110106.csv this is the result when I... (3 Replies)
Hi,
I am currently filtering a file, "BUILD_TIMES", that has multiple column of information in it. An example of the data is as follows;
Fri Nov 5 15:31:33 2010 00:28:17 R7_BCGNOFJ_70.68
Fri Nov 5 20:57:41 2010 00:07:21 R7_ADJCEL_80.6
Wed Nov 10 17:33:21 2010 00:01:13 R7_BCTTEST3_80.1X... (7 Replies)
Hi,
I am new to unix and would greatly appreciate some help.
I have a file containing multiple colums containing different sets of data e.g.
File 1:
John Ireland 27_December_69
Mary England 13_March_55
Mike France 02_June_80
I am currently using the awk... (10 Replies)
Hi,
I have a requirement to filter multiple entries in a text file.
Entries are a pair of 2 lines .Like
line1
line2
.......
........
Here line1, line2 consist of one pair. line1 and line2 contain different data.
There can be multiple entries for the same pair. And there can be 'n' such... (2 Replies)