07-23-2009
It is a good practice to check for uninitialized variables in a shell.
$logfile would have hopefully been caught in that.
Regards,
HKansal
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Is there a way to grep for something and then print out 10 lines after it.
for example if I want to grep for a word, then output the following 10 or whatever number of lines after the word. (5 Replies)
Discussion started by: eloquent99
5 Replies
2. Shell Programming and Scripting
Using shell scripts, I use grep to find the word “error” in a log file:
grep error this.log.
How can I print or get the line 3 lines below the line that word “error” is located?
Thanks in advance for your response. (9 Replies)
Discussion started by: cbeauty
9 Replies
3. Shell Programming and Scripting
I found another problem with my disk-adding script today. When looking for disks, I use grep.
When I grep for the following disk sizes:
5242880
I also pick up these as well:
524288000
How do I specifically pick out one or the other, using grep, without resorting to the -v option?
... (9 Replies)
Discussion started by: LinuxRacr
9 Replies
4. Shell Programming and Scripting
Hi All,
I have a log file and I want to parse the logfile with a script.A sample text is shown below:
I would grep on "return code " on this file. Any idea how the lines above and below the grep patterns could also be extracted.
Thanks!
nua7
The runLoggingInstall return code is 0... (3 Replies)
Discussion started by: nua7
3 Replies
5. Shell Programming and Scripting
Hello,
I would like for the user to input the date for a particular log file, then have the input sent to a variable, which is then used via grep to extra the logs for the specific date the user request.
I did some searching, but I still don't understand why I'm not seeing any result.
... (4 Replies)
Discussion started by: ravzter
4 Replies
6. Shell Programming and Scripting
I have a list of fields that I want to check a file for, returning that field if it not found at all in the file. Is there a way to do a grep -lc and return the passed variable too rather then just the count?
I am doing some crappy work-around now but I was not sure how to regrep this for :0 so... (3 Replies)
Discussion started by: personalt
3 Replies
7. Shell Programming and Scripting
I have a script which reads a number out of a log file. The pertinent line is this:
cat /tmp/listofnumbers
When I run cat /tmp/listofnumbers what I am seeing is on each line.
I am trying to make the script read from that file and grep for a variable like the following line should do:
... (4 Replies)
Discussion started by: newbie2010
4 Replies
8. Shell Programming and Scripting
Hi All,
When i am logged into a server , i am able to assign grep value to a variable as follows.
VAR=`grep 'Listener stopped' /logs/perf.log`
However, when i log out of the server, and try to execute the following command by first SSHing into server, it throws error.
$ VAR=`ssh Server... (4 Replies)
Discussion started by: srkmish
4 Replies
9. Shell Programming and Scripting
I have a lot of files with keywords and unique names. I'm using a shell script to refer to a simple pattern file with comma separated values in order to match on certain keywords. The problem is that I don't understand how to handle the wildcard values when I want to skip over the unique names.
... (5 Replies)
Discussion started by: abercrom
5 Replies
10. UNIX for Beginners Questions & Answers
Im trying to search for a single variable in the first field and from that output use awk to extract out the lines that contain a value less than a value stored in another variable. Both the variables are associated with each other.
Any guidance is appreciated.
File that contains the... (6 Replies)
Discussion started by: ncwxpanther
6 Replies
LEARN ABOUT DEBIAN
fixfiles
fixfiles(8) fixfiles(8)
NAME
fixfiles - fix file SELinux security contexts.
SYNOPSIS
fixfiles [-F] [-l logfile ] { check | restore|[-f] relabel | verify } [[dir/file] ... ]
fixfiles [-F] [ -R rpmpackagename[,rpmpackagename...] ] [-l logfile ] { check | restore | verify }
fixfiles [ -C PREVIOUS_FILECONTEXT ] [-l logfile ] { check | restore | verify }
fixfiles onboot
DESCRIPTION
This manual page describes the fixfiles script.
This script is primarily used to correct the security context database (extended attributes) on filesystems.
It can also be run at any time to relabel when adding support for new policy, or just check whether the file contexts are all as you
expect. By default it will relabel all mounted ext2, ext3, xfs and jfs file systems as long as they do not have a security context mount
option. You can use the -R flag to use rpmpackages as an alternative. The file /etc/selinux/fixfiles_exclude_dirs can contain a list of
directories excluded from relabelling.
fixfiles onboot will setup the machine to relabel on the next reboot.
OPTIONS
-l logfile
Save the output to the specified logfile
-F Force reset of context to match file_context for customizable files
-f Clear /tmp directory with out prompt for removal.
-R rpmpackagename[,rpmpackagename...]
Use the rpm database to discover all files within the specified packages and restore the file contexts. (-a will get all files in
the RPM database).
-C PREVIOUS_FILECONTEXT
Run a diff on the PREVIOUS_FILECONTEXT file to the currently installed one, and restore the context of all affected files.
ARGUMENTS
One of:
check print any incorrect file context labels, showing old and new context, but do not change them.
restore
change any incorrect file context labels.
relabel
Prompt for removal of contents of /tmp directory and then change any incorrect file context labels to match the install file_con-
texts file.
verify List out files with incorrect file context labels, but do not change them.
[[dir/file] ... ]
List of files or directories trees that you wish to check file context on.
AUTHOR
This man page was written by Richard Hally <rhally@mindspring.com>. The script was written by Dan Walsh <dwalsh@redhat.com>
SEE ALSO
setfiles(8),restorecon(8)
2002031409 fixfiles(8)